I use the following code and works fine! ...
<?php
/ Connecting, selecting database /
$link = mysql_connect("localhost", "x", "x") or die("Could not connect");
//echo "Connected successfully";
mysql_select_db("cltbooking") or die("Could not select database");
print "\nTotal Sites: <br>";
$sql = 'SELECT count(ID) FROM agency';
$results = mysql_query($sql);
$count = 0;
$data = array();
while ( $row = mysql_fetch_array($results))
{
$data[$count] = $row;
$count++;
}
mysql_free_result($results);
print $data[0][0];
print "\n<br>Total Pages Indexed: ";
?>