so I have this query:
SELECT COUNT( * ) AS cnt
FROM table
WHERE datetime > NOW( ) - INTERVAL 45
SECOND
When I preform this query in MySQL I get the result: cnt 25
(http://puu.sh/7ZNh.png)
I now want to echo this in my PHP page, how would I do this?
UPDATE:
Here is the full code
<?php
$con = mysql_connect("host","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$query = ("SELECT COUNT(*) FROM usersonline WHERE datetime > NOW() - INTERVAL 5 MINUTE");
$result = mysql_query($query);
?>