Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecht with no rows problem

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hello ,

$result = mysql_query("select * from tblTest");

how can I check if there are records in the tabel or not?
I thought of: mysql_num_rows($result) > 0 but it doesn't work? The One And Only KryptoS
 
mysql_num_rows() will return the number of rows returned by a query. If you are performing "SELECT * from table", which will select all rows, mysql_num_rows() will return the number of rows in the table.

You say it doesn't work. What is mysql_num_rows() returning for that query?


Another way to get the number of rows in a table is to perform "SELECT count(*) from table", which will return the number of rows in a table. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top