Jump to content

Can anyone help with this mysql query?


zoonose

Recommended Posts

I am trying to recover a multidimensional array with the following code, however, it doesn't seem to be working!

If i replace $query_date with a numerical (unix timestamp) i.e '1204894800' - it works a treat. i cannot understand why it wont work with a variable?

   1. $date = mktime(0,0,0,date('m'), date('d'), date('Y'));
   2. $day = date('d', $date);
   3. $month = date('m', $date);
   4. $year = date('Y', $date);
   5.  
   6. $SelMthDays = cal_days_in_month(0, $month, $year);
   7. echo $SelMthDays;
   8. $Palm_events = array();
   9. for ($i=1;$i<=$SelMthDays;$i++){
  10.     $query_date = mktime(0,0,0,$month,$i,$year);
  11.     $sql = "SELECT e_family FROM `dates` WHERE e_date = $query_date";
  12.     $result = mysql_query($sql,$con);
  13.     $Palm_events[$i] = mysql_fetch_row($result);
  14.     
  15. }
  16.  
  17. print_r($Palm_events);

Link to comment
https://forums.phpfreaks.com/topic/93584-can-anyone-help-with-this-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.