Jump to content

[SOLVED] Need possible way to shorten query


simcoweb

Recommended Posts

Due to some goofy code in a script my clients are using I have to create multiple category fields in the database instead of one category field. So, to do a search I have this query:

 

$sql = "SELECT * FROM amember_members WHERE is_lender='0' AND category1='$category' OR category2='$category' OR category3='$category' OR category4=''$category' OR category5='$category' AND loan_type='$loantype' AND loan_amount='$loanamount' ORDER BY top_3 LIMIT 10";

 

Basically all the OR statements are checking against the same $category variable to see if they match. I was wondering if there's a shorter way to write the OR statement, perhaps consolidate them... ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.