I've got a PHP warning in my web app. I'm a bit of a noob. I want to add a timezone offset to the 'updated' timestamp based on the 'adjusttimezone' integer in each user's profile?
This is the code:
$timezonequery = mysql_query('SELECT adjusttimezone FROM members WHERE member_id=' . $_SESSION["myid"]);
$timezone = (int)mysql_result('$timezonequery', 0);
$updatedquery = mysql_query('SELECT DATE_ADD(updated, INTERVAL ' . $timezone . ' HOUR) FROM projects WHERE project_id=' . $i);
It works, but I'm worried about this warning:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in xxx.php on line 9
Can anyone help? Thanks
You are passing $timezonequery as a string, it is expecting a mysql resource. Remove the quotes from your mysql_result call:
$timezone = (int)mysql_result('$timezonequery', 0); // With quotes
$timezone = (int)mysql_result($timezonequery, 0); // Without