[solved] having trouble with mysql query?
Posted: Thu Feb 28, 2008 4:42 pm
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?
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?
Code: Select all
$date = mktime(0,0,0,date('m'), date('d'), date('Y'));
$day = date('d', $date);
$month = date('m', $date);
$year = date('Y', $date);
$SelMthDays = cal_days_in_month(0, $month, $year);
echo $SelMthDays;
$Palm_events = array();
for ($i=1;$i<=$SelMthDays;$i++){
$query_date = mktime(0,0,0,$month,$i,$year);
$sql = "SELECT e_family FROM `dates` WHERE e_date = $query_date";
$result = mysql_query($sql,$con);
$Palm_events[$i] = mysql_fetch_row($result);
}
print_r($Palm_events);