Syntax Error, Unexpected T_STRING in PHP Recordset

advertisements

This question already has an answer here:

  • PHP Parse/Syntax Errors; and How to solve them? 11 answers

I have error :-

Parse error: syntax error, unexpected T_STRING in php record set in

$query_Recordset2 = "SELECT stu_ID,stu_name, GROUP_CONCAT(if(class_no="lec_1", `attstatus`, NULL)) AS 'Lecturer 1', GROUP_CONCAT(if(class_no="lec_2", `attstatus`, NULL)) AS 'Lecturer 2' FROM attendance WHERE session_ID="1" GROUP BY stu_ID,stu_name";

There free syntax error during testing at dreamweaver but when open the php file in browser pop out this error.Any solution to fix it?

Thanks


Replace your string with this

$query_Recordset2 = "SELECT stu_ID,stu_name, GROUP_CONCAT(if(class_no='lec_1', attstatus, NULL)) AS 'Lecturer 1', GROUP_CONCAT(if(class_no='lec_2', attstatus, NULL)) AS 'Lecturer 2' FROM attendance WHERE session_ID GROUP BY stu_ID,stu_name";