I'm having a little trouble writing an if statement to update a couple of database fields based on matching a student ID between 2 tables. This is a form where I pass the initial Student and Class IDs to the SQL statement (this works just fine, but when I try to add the IF statement layer, I keep getting a T_CLASS parse error.
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;
Can anyone tell me what I'm missing? I've tried separating these out with parens but this didn't make a difference.
Thanks!