表中的玩家数量?

I want to print the total number of gamertags in a table which equals the rows.

$total = mysql_query('SELECT COUNT(*) FROM gamertags');
print $total;

The code above prints this idk why?

Resource id #3

I agree with the other guys, it's all explained on that page. But here's the answer anyway...

$result = mysql_query('SELECT COUNT(*) FROM gamertags');
$total = mysql_result($result, 0);
echo $total;

Because that's returning a mysql result variable. You can access the actual data with mysql_result().

Your code should be this:

$sql = mysql_query('SELECT COUNT(*) AS number FROM gamertags');
$total = mysql_fetch_array($sql);
echo $total;

lol everyone is so critical...

$sql = mysql_query("SELECT COUNT(*) AS number FROM gamertags");
$resultsArray = mysql_fetch_array($sql);
echo $resultsArray["number"];

mysql_fetch_array() will take a mysql resource and parse it into an indexed array and an associative array.

array(
      [0] => <number>,
      [number] => <number>
     )

mysql_fetch_assoc() will take a mysql resource and put it into an associative array only.

array(
       [number] => <number>
     )