Syntax error with WHERE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeff5656
Forum Newbie
Posts: 4
Joined: Mon Mar 03, 2008 4:57 pm

Syntax error with WHERE

Post by jeff5656 »

I am new to this so I assume this is a very stupid error, but I have a field in my table called signoff_status and the type is ENUM. The values in enum are "s" or "a".

Here's the code:
$query = "SELECT patient_name, mrn, location, fellow, rcf_date, admission, consult_reason, impression, recs, comments ".
"FROM active_consults ORDER BY patient_name".
"WHERE signoff_status = 'a' ";

I get the error at the where line.

Basically I just want to display records that have an "a" in the signoff_status field.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Syntax error with WHERE

Post by Benjamin »

The where clause goes before the order by.
jeff5656
Forum Newbie
Posts: 4
Joined: Mon Mar 03, 2008 4:57 pm

Re: Syntax error with WHERE

Post by jeff5656 »

Thank you that worked!
Post Reply