Parse error in MySQL IF statement
Posted: Tue Sep 06, 2011 9:37 pm
I keep getting this error (below) can anyone tell me what I'm doing wrong? The SQL statement worked as a standalone, but boms as an IF statement...
Parse error: syntax error, unexpected T_CLASS, expecting '(' in /home/www/vhosts/contractor-training-ca.org/httpdocs/form_processors/do_confirm.php on line 11
Parse error: syntax error, unexpected T_CLASS, expecting '(' in /home/www/vhosts/contractor-training-ca.org/httpdocs/form_processors/do_confirm.php on line 11
Code: Select all
IF class.s1i=$SID THEN $sql="update students, class SET students.currentStatus='confirmed',students.timeStamp='$dateLastUpdated', class.s1s='confirmed' where students.SID=$SID";
ELSEIF class.s2i=$SID THEN $sql="update students, class SET students.currentStatus='confirmed',students.timeStamp='$dateLastUpdated', class.s2s='confirmed' where students.SID=$SID";
ELSE echo "no match";
END IF;