Change your code from
$query = "SELECT COUNT( id ) FROM scores WHERE id = $id;";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
to
$query = "SELECT COUNT( id ) as `total_ids` FROM scores WHERE id = $id";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
after that you need
$count = mysql_fetch_assoc($result);
echo $count['total_ids']; // it will give you result
when writing a query there is no need to use a ;
inside a string unless your writing multiple queries. which btw are not supported by normal mysql.
other than that mysql_*
is no longer supported please check this link for mysqli_*
database driver
0
solved PHP script ,MySQL