MySQL Forums
Forum List  »  PHP

Re: SELECT statement error
Posted by: Felix Geerinckx
Date: February 24, 2006 08:21AM

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.

Options: ReplyQuote


Subject
Written By
Posted
February 24, 2006 07:28AM
Re: SELECT statement error
February 24, 2006 08:21AM
February 24, 2006 08:49AM
February 24, 2006 08:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.