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
https://forums.phpfreaks.com/topic/827-unlimented-selection-conditions/
Share on other sites

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.