Please I get this error code when executting this script Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a777gqka/public_html/testserver/index.php on line 47
$query = mysql_query("SELECT
e.id,
ts.name AS stage_name,
DATE_FORMAT(e.startdate, '2013-05-15') AS startdate,
DATE_FORMAT(e.startdate, 'H:i') AS starttime,
MIN(if( ep.number = 1, p.name, NULL)) AS home_team,
if(e.status_type = \"notstarted\", \"-\",(MIN(if(ep.number = 1, r.value, NULL)))) AS home_score,
if(e.status_type = \"notstarted\", \"-\",(MIN(if(ep.number = 2, r.value, NULL)))) AS away_score,
MIN(if(ep.number = 2, p.name, NULL)) AS away_team,
es.name AS status_text
FROM
tournament_template AS tt INNER JOIN
tournament AS t ON t.tournament_templateFK = tt.id INNER JOIN
tournament_stage AS ts ON t.id = ts.tournamentFK INNER JOIN
event AS e ON ts.id = e.tournament_stageFK INNER JOIN
event_participants AS ep ON e.id = ep.eventFK LEFT JOIN
status_desc AS es ON e.status_descFK = es.id LEFT JOIN
participant AS p ON ep.participantFK = p.id LEFT JOIN
result AS r ON ep.id = r.event_participantsFK AND r.result_code = \"runningscore\" LEFT JOIN
property AS prop ON e.id = prop.objectFK AND prop.object =\"event\" AND prop.name = \"Live\"
WHERE
tt.sportFK = ".$sportFK." AND
e.startdate BETWEEN ".$TODAY_FROM." AND ".$TODAY_TO." AND
prop.value = \"yes\"
GROUP BY
e.id
ORDER BY
ts.id, e.startdate, e.id");
while($row = mysql_fetch_assoc($query)){
// Do something
}