Excluding certain results.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
slater
Forum Newbie
Posts: 10
Joined: Tue Mar 23, 2004 12:13 pm
Location: Nottingham, England

Excluding certain results.

Post by slater »

Hey,

I have a search feature on my site, this searchs the users of the site and displays the profile depending on the search criteria,

however there is a field in the user table that is either TRUE or FALSE and i need to exlude all the reults that are FALSE from any search.

Is there a simple bit of code i need or is it something more complicated?

Cheers,
Slater
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

You need a query like this

Code: Select all

SELECT * FROM sometable WHERE field = 'TRUE'
That will exclude all rows where field = FALSE

Mark
slater
Forum Newbie
Posts: 10
Joined: Tue Mar 23, 2004 12:13 pm
Location: Nottingham, England

Post by slater »

Sorry should have also said there is already one WHERE in the statement, does this matter?

here it is(modified):

Code: Select all

$sql = "SELECT * from questions WHERE field = 'TRUE' WHERE q_page>$page order by q_seq ascs";
Cheers
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Try this

Code: Select all

$sql = "SELECT * FROM questions WHERE field = 'TRUE' && q_page>$page ORDER BY q_seq ASC";
Mark
slater
Forum Newbie
Posts: 10
Joined: Tue Mar 23, 2004 12:13 pm
Location: Nottingham, England

Post by slater »

Fixed it,

Thanks for your help.

P.S Nice flash header on your website :D
Post Reply