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?
<?
$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?