I am trying to display the amount of users that have been active on my website within the last 10 minutes, however I am having trouble with the query syntax and receiving the error "mysql_num_rows() expects parameter 1 to be resource, boolean given..."
<?php
$dt = date('Y-m-d h:i:s');
$checktime = $dt - 600;
$query = "SELECT * FROM users WHERE DATE(STR_TO_DATE(lastactive)) BETWEEN '$checktime' AND '$dt'";
$result = mysql_query($query);
$num = mysql_num_rows($result);
echo $num;
?>
Really need help to sort this out, and please don't comment on the deprecation of simple MySQL functions, I am aware of it.