OKay so this my have been asked before but I have more of a general question than an issue. I don't understand Mysql_num_rows() becuase I don't have any information within my database table so the number or rows should be 0 but what happens is I get an error and it says that Mysql_num_rows is not a valid argument. How can I find out then if there a piece of data within in a table without using mysql_num_rows()?

Member Avatar for diafol

I just created a blank db called 'strings' and did this:

$r = mysql_query("SELECT * FROM strings");
echo mysql_num_rows($r);

And I got '0' to the screen - as expected.
valid argument error usually means that your SQL if wrong. Show your code.

But please tell me it was a typo and you really meant mysqli_num_rows not mysql_num_rows.

$r = mysqli_query($link,"SELECT * FROM strings");
echo mysqli_num_rows($r);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.