Combining OR with BOOLEAN MODE in Query

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

Moderator: General Moderators

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if you did, your code isn't dynamic enough to generate the query yet.
BZorch
Forum Commoner
Posts: 45
Joined: Mon May 02, 2005 10:42 pm

Post by BZorch »

Thank you for pushing me in the right direction. The script seems to be working perfectly now.

For information for others on how I got it to work, I set each variable to the portion of the query (i.e. "(Field1='".$value1."') AND") that included its information and then used an ifelse() that check to see if each variable existed. If it did it added the query strings together, if not it added a blank space. Once it went through the five variables, I used trim() first and then rtrim the AND if it did not end with the last variable.

It definitely used less code and works much better. Thank you again.
Post Reply