PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi,
I have tried to count how many records I have in mysql database.
I am trying to count how many times 'action' is found in the column 'category' in the table 'games'.
I have found a few online demos but still had no luck. How would I edit the following code to count what I mentioned above?
Thats what I have tried!
Why isn't it working? I am getting very frustrated because it seems so easy but still no luck, just blank no errors or anything!!
This is what I have:
<?php
$query = "SELECT COUNT(*) AS total FROM games WHERE category = 'action'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
$count = $row["count"];
}
echo $count;
?>