Jump to content


Photo

Unlimented selection conditions


  • Please log in to reply
No replies to this topic

#1 gandolf1212

gandolf1212
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 04 August 2003 - 06:17 AM

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).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users