PDA

View Full Version : Trying to count total users with query seperate of forum


BamaStangGuy
07-09-2005, 08:28 PM
On my main page I want to show the total registered users and I am using this:


<?
$dbhost = 'localhost';


$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'mustangevolution';
mysql_select_db($dbname);

$res = mysql_query('SELECT COUNT(*) as total FROM user');
$row = mysql_fetch_assoc($res);
$total = $res['total'];

echo '<b>' .$total. '</b>';
?>

What am I missing?

Guest190829
07-09-2005, 08:45 PM
You shouldn't post your entire database information, it could be a serious security issue.

AN-net
07-09-2005, 10:30 PM
instead of putting stress on your user table why not just use the datastore table or just include global.php and all datastore is available to you:)

Revan
07-09-2005, 11:29 PM
Then again, calling global.php also adds the what, 6 other queries that he may have no usage whatsoever for.
I recommend doing the datastore query as suggested, to add less overhead.

Andreas
07-09-2005, 11:32 PM
You shouldn't post your entire database information, it could be a serious security issue.
I can't connect to localhost with this Username/Password, what am I doing wrong?

Biker_GA
07-10-2005, 12:39 AM
Hmmmmm. Betcha it would work if you looked up his website and attempted an SSH. ;)