Jump to content

Unlimented selection conditions


gandolf1212

Recommended Posts

Okay, I\'m writing a script that I was to have an infinite amount of selection conditions.

 

Think something like

 


foreach($condition as $_){

$con .= "$_ AND";

}



// enter code to get rid of that last AND...



$result = mysql_query("select * from `table` where $con");

 

However, will something go wrong is there are too many conditions? I mean, I\'m not talking thousands, but like 50? 100?

 

I know there will be performance issues but that\'s not a big deal, so long as were just talking 5-10 seconds, maybe a tad more but definitely well under 30, which seems to be timeout level.

 

Anyone know a better alternative? I was thinking about doing a big loop of mysql_result checks but would that even be faster? (I know there are a ton of optimizations in mySQL). Plus the way I have now is soooo easy. I mean, I turned a collage level problem into a comp sci 1 extra credit problem with my idea, just kinda looking for a better implementation of basically the same idea. especially a way to break that one huge query into many smaller queries.

 

Thanks a bunch if you can help. I\'m not that good on mySQL yet when it comes to the higher level queries. (doc\'s seem way to reference like to really read through).

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.