Ok, here's the segment of code. Basically what it does is process football scores that are passed from the previous page. The code in question is in the "if ($sc_aw == $sc_ho)" statement that checks for ties. I know that the SQL statement syntax is correct as I've tested it with my server. The SQL statements with variables in them also evaluate to correct statements as I've 'print'ed them out to make sure they were correct.
Thanks.
Mike
<?PHP
$dbc = mysql_connect("localhost", "webuser", "");
$query = "SELECT away, home FROM schedule WHERE day = 'Thursday'";
$result = mysql_db_query("pool", $query);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$aw = $r["away"];
$ho = $r["home"];
$sc_aw = ${'score'.strtr($aw,' ','')};
$sc_ho = ${'score'.strtr($ho,' ','')};
if ($sc_aw == $sc_ho)
{
print "$aw: Tie-1 PF: $sc_aw PA: $sc_ho<BR>";
print "$ho: Tie-1 PF: $sc_ho PA: $sc_aw";
$s_query = "SELECT ties FROM teams WHERE teamname='$aw'";
$s_result = mysql_db_query("pool", $s_query);
$aw_ties = mysql_result($s_result, 0);
$aw_ties++;
$t_query = "UPDATE teams SET ties=$aw_ties WHERE teamname='$aw'";
$t_result = mysql_db_query("pool",$t_query);
}
else if ($sc_aw > $sc_ho)
{
print "$aw: Win-1 PF: $sc_aw PA: $sc_ho<BR>";
print "$ho: Loss-1 PF: $sc_ho PA: $sc_aw";
}
else if ($sc_aw < $sc_ho)
{
print "$aw: Loss-1 PF: $sc_aw PA: $sc_ho<BR>";
print "$ho: Win-1 PF: $sc_ho PA: $sc_aw";
}
}
}
else
{
print "<TR><TD>No scores to be recorded.</TD></TR>";
}
mysql_close($dbc);
?>