Richard Mullins wrote:
> I am unable to get this select statement to work as part of a php file I am coding:
>
> $sql = "SELECT project_ID, SK_ID, lecturer_role, project_name FROM `student_project` ORDER BY" . $order;
>
> I keep getting this same error message:
>
> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near '' at line 1
Are you sure there is something in the $order variable? If so, does it start with a space character?
It is always a good idea to echo the $sql variable somewhere to be able to verify whether it contains what you think it contains.
--
felix
Please use
BBCode to format your messages in this forum.