Page 1 of 1

Ambiguous Query Results

Posted: Fri Oct 15, 2004 9:00 am
by Harlequin
Hi all. I'm hoping someone with more knowledge than me can help with this little canundrum...

I have the following query:

Code: Select all

// Count Total Users: 
   $Query11 = "SELECT COUNT(*) FROM MembersData
   WHERE ID != ''"; 
   $Result11 = mysql_query($Query11) or die("Error 11: " . mysql_error()); 
   $UsersTotal = mysql_result($Result11, 0);
Which counts the number of records. However, if I echo the results on screen I get 136 but if I stuff them into a tale I get 127.

Mad, I know but it's true...!

Posted: Fri Oct 15, 2004 9:58 am
by twigletmac
What is the code you are using to echo the results and what is the code used to insert them into a table?

BTW, you can save your database some effort by doing COUNT(ID) instead of COUNT(*):

Code: Select all

SELECT COUNT(ID) FROM MembersData WHERE ID <> ''
Mac