Page 1 of 1

Excluding certain results.

Posted: Tue May 25, 2004 6:22 am
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

Posted: Tue May 25, 2004 6:35 am
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

Posted: Tue May 25, 2004 6:51 am
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

Posted: Tue May 25, 2004 6:57 am
by JayBird
Try this

Code: Select all

$sql = "SELECT * FROM questions WHERE field = 'TRUE' && q_page>$page ORDER BY q_seq ASC";
Mark

Posted: Tue May 25, 2004 7:08 am
by slater
Fixed it,

Thanks for your help.

P.S Nice flash header on your website :D