MySQL query problem

Possible Duplicate:
Warning: mysql_fetch_* expects parameter 1 to be resource, boolean given error

 $result3=mysql_query("select * from $mail ORDER BY `data_id` DESC"); 

in this case if data_id is NULL query is showing Warning - Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in F:xampphtdocs...


If mysql_query fails, it returns false . You need to check that before you pass $result3 to any other mysql function. (Also print or log the error in that case so you can debug it.)


As it describes in the official document,

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

So the parameter 1 is false

See: http://php.net/manual/en/function.mysql-query.php

链接地址: http://www.djcxy.com/p/69410.html

上一篇: PHP

下一篇: MySQL查询问题