Forum Moderators: coopster
$query = mysql_query("SELECT * FROM Eventssession1 WHERE EVENTID= '1004' LIMIT 1")or die(mysql_error());
$row = mysql_fetch_object($query);
$spaceq = mysql_query("SELECT SUM(IF(Session1_9 = 'Art in Narration - 9:00'),1,0) AS total FROM Students");
$space = mysql_fetch_array($spaceq);
$number = $space['total'];
if ($number < '13')
{
echo $row->EventName;}
else
{
echo "Class Full";
}
$query = "SELECT COUNT(`Session1_9`) as `Num_students` FROM Students WHERE `Session1_9` = 'Art in Narration - 9:00'";
:)
I don't know what kind of speed advantages you'd get using COUNT instead of the other method, however it should be a little faster. To count is, after all, what the function is meant to do :) Try the query I showed you to see if it improves the time. (It shows the time if you run the query in the command line).