what is the notice: resource id#9? [duplicate]
Possible Duplicate:
How do i “echo” a “Resource id #6” from a MySql response in PHP?
I created a SELECT query but it has an error. When I print_r(result) I get the resource id#9 notice here is the code:
$query= "SELECT * FROM {$hotel_开发者_运维问答name} WHERE Bdate BETWEEN {$chack_in} AND {$chack_out}";
$availability = mysql_query($query);
confirm_query($availability);
print_r($availability);
'$availability` prints as 'resource id#9' because it is a resource. http://php.net/manual/en/language.types.resource.php
There is nothing wrong with this, it is expected. mysql_query
returns resource types when the query executes successful, and false
when it fails. You can call mysql_fetch_*($resource)
on that resource to get data from it.
(Where * is assoc
, object
, array
, etc)
$availability is the handle to the results, the fact it says #9 would imply it worked. You then need to loop through getting the results from $availability.
精彩评论