I am baffled, I have the following query which should return 4 records but for some reason it is counting 8 records and returning each row twice. I know I could use distinct, but as I also know that there are no duplicate records in this table I don't want to resolve the problem that way but find out what is causing it.
public function get_online_classes_per_dog($entry_id) {
$sql = mysql_query("SELECT class_number FROM running_orders WHERE entry_id='".$entry_id."' ORDER BY class_number ASC");
echo mysql_num_rows($sql);
$results = mysql_fetch_array($sql);
return $results;
}
I have echo'd the $sql and run in directly in the database and I get 4 records as I should but echoing the mysql_num_rows gives me 8 and when I run a while or foreach loop on my main page I get each class_number eching out twice (for example it should be 1, 2, 3, 4 but I am getting 1, 1, 2, 2, 3, 3, 4, 4).
Any ideas, never come across anything like this before and is driving me mad??