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.
Row
"``` to see the result set. That may clear up how to reference what is returned. – Sloan Thrasher Apr 16 '17 at 21:03