开发者

How can i tell if a MySQL query returned nothing in PHP?

I'm using PHP5 and M开发者_如何学编程ySQL. I'm using mysql_...() functions.


if (mysql_num_rows($query_identifier) == 0)
  echo "Query returned 0 rows";

Additionally, mysql_query() returns false in case of an error.

Manual: MySQL functions in PHP


If you are using mysqli_ functions, you can call $stmt->num_rows(). But only after calling $stmt->store_result() to ensure all the rows have been returned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜