lk******@geocities.com wrote:
Suppose I make a call to MySql and zero rows come back. How do I tell
the difference between zero rows and failure?
From the mysql_query() doc:
Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query()
returns a resource identifier or FALSE if the query was not executed
correctly. For other type of SQL statements, mysql_query() returns TRUE
on success and FALSE on error. A non-FALSE return value means that the
query was legal and could be executed by the server. It does not
indicate anything about the number of rows affected or returned.
From the mysql_num_rows() doc:
mysql_num_rows() returns the number of rows in a result set. This
command is only valid for SELECT statements.
In other words: if mysql_query() returns false, it's failure. If it's
not failure, then you can use mysql_num_rows() to see how many rows you get.