Jump to content

[SOLVED] Make these IF statements scaleable


tontox5

Recommended Posts

This is part of a mysql query, and I just can't figure out how to make it scaleable. Anyone got ideas?

 

if ($word_count==1) $boolean_query = "('+$search_words[0]*' IN BOOLEAN MODE)";
if ($word_count==2) $boolean_query = "('+$search_words[0]* +$search_words[1]*' IN BOOLEAN MODE)";
if ($word_count==3) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]*' IN BOOLEAN MODE)";
if ($word_count==4) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]* +$search_words[3]*' IN BOOLEAN MODE)";
if ($word_count==5) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]* +$search_words[3]* +$search_words[4]*' IN BOOLEAN MODE)";

Link to comment
Share on other sites

Hey Rhodesa, the first code you gave me works great.

 

I didn't know you could append to the $boolean_query variable by adding a period before the equal sign.

 

Learn something new every day,

 

A grateful beginner,

 

Nick

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.