php - Whats the proper way to check if mysql_query() returned any results? -


I tried what seemed like the most intuitive approach

  $ query = "SELECT * FROM member WHERE user name = '$ _CLEAN [username]' and password = '$ _CLEAN [password]'"; $ Result = mysql_query ($ query); If ($ result) {...  

but it is not working because mysql_query returns a real value, even if 0 rows are returned I basically want to execute only the arguments in that situation if I returned a line.

Use:

  if (mysql_num_rows ($ result)) {// do stuff}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -