Can't locate problem with this query
Posted: Thu Nov 14, 2002 2:24 pm
I am hoping someone can spot what I am doing wrong here. Everything is working right except for the UPDATE query which returns this error:
You have an error in your SQL syntax near ')' at line 1. I have been unable to figure out what is wrong. The code is as follows:
I am new to this so I am sure it will be a silly mistake but I hope someone can spot where I went wrong in the query. Thanks!
You have an error in your SQL syntax near ')' at line 1. I have been unable to figure out what is wrong. The code is as follows:
Code: Select all
mysql_select_db($database_dbi, $dbi);
$query_getstrike = "SELECT * FROM ".$user_prefix."_strike_count WHERE uname='$uname'";
$getstrike = mysql_query($query_getstrike, $dbi) or die(mysql_error());
$row_getstrike = mysql_fetch_assoc($getstrike);
$totalRows_getstrike = mysql_num_rows($getstrike);
$numstrikes=$row_getstrikeї'strikes'];
if($numstrikes < 3){
$numstrikes++;
$totalstrikes=$numstrikes;
echo "The number of strikes now is:$totalstrikes";// my variable checking code//
mysql_query(" INSERT INTO ".$prefix ."_attendance ( tid, uname, mday, month, year, attend, comments )
VALUES ( '$tid', '$uname', '$mday', '$month', '$year','$attend', '$comments' )",$dbi) or die ("Couldn't insert info");
if (!isset($uname)){
mysql_query(" INSERT INTO ".$prefix ."_strike_count ( uname, strikes) VALUES ('$uname','$strikes')", $dbi) or die (mysql_error());
}
else {
mysql_query(" UPDATE ".$prefix ."_strike_count SET strikes=$totalstrikes WHERE uname ='$uname')", $dbi) or die (mysql_error());
}
}
}