PDA

View Full Version : mySQL count(*) query returning a weird value


zeroality
09-09-2006, 07:46 AM
$membercount = $db->query_read('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'user');

Then I have my php file echo $membercount and it displays "Resource ID 15"...

What? I also tried this:

$membercount = $db->query_read('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'user');

$membercount = vb_number_format($membercount);

That simply makes it display "15". :(

I want to be able to display how many users I have registered on an external forum page so all I need is to get that mySQL query working right. Any help is appreciated.

Zachery
09-09-2006, 11:33 AM
Because you did a select count from the ENTIRE table, not a specific field

use

$membercount[users]

TrueDeath
09-09-2006, 12:07 PM
try $db->fetch_array instead.