October 4th, 2012, 08:29 AM
Query returning strange resource
I am running a MySQL query from my php page but it is returning a whole host of resources instead of a result...
This is the code
Where activate_shutdown_process = 1, shutdown_time = mid day today and estimated_maintenance_period_in_mins = 720 (12hrs)
$query = "SELECT activate_shutdown_process, IF(NOW() > shutdown_time, -1, MINUTE(TIMEDIFF(shutdown_time, NOW()))), estimated_maintenance_period_in_mins FROM server_shutdown_settings";
$result = mysql_query($query, $db);
If I echo out the result I get a resource and if I echo out a print_r of the result I get a resource as well...
October 4th, 2012, 08:34 AM
Please use [ PHP ] tags around your PHP script rather than [ CODE ] tags. See ManiacDan's New User Guide.
You are getting exactly what you should. That call returns a result resource. You use that resource to fetch the data.
Rather than give you the code to do that I instead urge you to switch to PDO rather than the depreciated MySQL library.
Comments on this post
There are 10 kinds of people in the world. Those that understand binary and those that don't.