WHERE ID= error
Posted: Tue Jul 09, 2002 9:02 pm
I am having trouble with this code. all it is supposed to do is act as a counter and a score keeper, for a rating script.
I always get this error: You have an error in your SQL syntax near 'WHERE ID=''' at line 1Error: 1
someone please help me or show me what i am doing wrong.
here is the code:
I always get this error: You have an error in your SQL syntax near 'WHERE ID=''' at line 1Error: 1
someone please help me or show me what i am doing wrong.
here is the code:
Code: Select all
<?
if ($SCORE > 10) {
echo "NO GOOD CHEATER!";
exit;
} else {
$PASS = "*****";
// DB connection information
$connection = mysql_connect("localhost", "cekkent", $PASS);
$db = mysql_select_db("cekkent", $connection);
// SQL Query
$result=mysql_query ("select * from rate where ID='$ID'") or die (mysql_error());
while($row=mysql_fetch_array($result)){
// Make that Mofo do something
$VOTES = $rowї"VOTES"];
$VOTES=$VOTES+1;
}
$result = mysql_query("UPDATE rate SET VOTES=$VOTES WHERE ID='$ID'");
if(!$result) {
die("<b>Error:</b> " . print mysql_error());
exit;
} elseif($result) {
print "Continue1";
}
$result=mysql_query ("select * from rate where ID='$ID'") or die (mysql_error());
while($row=mysql_fetch_array($result)){
// Make that Mofo do something
$SCORE1 = $rowї"SCORE"];
$SCORE=$SCORE1+$SCORE;
}
$result = mysql_query("UPDATE rate SET SCORE=$SCORE where ID='$ID'");
if(!$result) {
die("<b>Error:</b> " . print mysql_error());
exit;
} elseif($result) {
mysql_close ($connection);
print " Continue2";
}
}
?>