$rs = mysql_query("SELECT user, userid FROM House WHERE userid='$userid'");
This return Resource id #37
The table House is empty, shouldn't it return FALSE? According to the manual http://php.net/manual/en/function.mysql-query.php
I have always gotten FALSE on error, but not this time. Can someone explain, thanks!
If there is nothing wrong with your query, then mysql_query()
will not return false
. An empty result set is not an error.
Calling any of the fetch functions against that result will return false
. mysql_num_rows()
will return 0
.
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or false on error .
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc it returns trueon success or false on error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.