Q:

Return Count From Database Into PHP As Variable

I'm trying to get a count of how many entries are in a database by using COUNT in SQL similar to this. This is my code, it returns/echos nothing.
$result=mysqli_query($con,"SELECT COUNT(id) as total FROM Customer");

if (!$result) echo mysql_error();

$row=mysqli_fetch_assoc($result);

echo $row['total'];

$id=$row['total'];

echo($id);

What is wrong? The connection info is correct and has no errors.
Update: I still need help with this. Please stop downvoting and not giving answers. If it's a question with an obvious answer please tell me.
Update: This is not at all a duplicate of that question. The issue was not specifically with error reporting.
Update: I answered this question and figured out my problem was with the default database which is why nothing was being returned. I can't select my answer until tomorrow.

A:

I never put mysqli_select_db ( $con, "....."); Into my file so it never knew what database to use. I also was not getting errors because I was using mysql_error instead of mysqli_error. Once I selected the default database, it worked fine.

