SELECT statement not working?
Posted: Wed Oct 26, 2005 8:16 am
I'm creating a website for my soccer team, but when trying to show the results page I'm getting the standard error:
If I change the SELECT statement to a basic SELECT * from matches, it works ok? Is there something wrong with my syntax on the $query variable?
I hope someone can help.
Here is a snippet from my code:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in e:\domains\r\risingsun.frolicols.co.uk\user\htdocs\results.php on line 43
Code: Select all
$query = "SELECT match_date,
DATE_FORMAT (match_date, '%d/%m/%Y') as match_date_format,
match_venue,
match_pitch,
match_opp,
match_sunscore,
match_oppscore,
mt.matchtype_name as match_type,
match_cup_round,
match_report
FROM matches as mc
INNER JOIN matchtype as mt ON (mc.match_type_id = mt.matchtype_id) WHERE match_sunscore IS NOT NULL ORDER BY match_date";
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_assoc($result))
{
$matchdate = $row['match_date_format'];
$venue = $row['match_venue'];
$pitch = $row['match_pitch'];
$opp = $row['match_opp'];
$sunscore = $row['match_sunscore'];
$oppscore = $row['match_oppscore'];
$matchtype = $row['match_type'];
$cupround = $row['match_cup_round'];
$report = $row['match_report'];I hope someone can help.