matty84 Posted November 25, 2006 Share Posted November 25, 2006 Hi,i was wondering if is was possible to terminate a php command when it reaches a certain number. Basically I am searching an access database over odbc and I want to limit the results to 200. I have a count going on in php and i was wondering if there was a way to tell php to stop pulling in results when the count reaches 200?Any ideas?matt Link to comment https://forums.phpfreaks.com/topic/28463-stopping-database-search/ Share on other sites More sharing options...
fert Posted November 25, 2006 Share Posted November 25, 2006 [code]while(1){if($count<200){/*do stuff*/...}else{break;}}[/code]or[code]while($count<200){/*do stuff*/...$count++;}[/code] Link to comment https://forums.phpfreaks.com/topic/28463-stopping-database-search/#findComment-130252 Share on other sites More sharing options...
Psycho Posted November 25, 2006 Share Posted November 25, 2006 If you are pulling the data in from a database it is more efficient to limit the data through the query. The operator to restrict the number of records returned in MySQL is "LIMIT". Perhaps there is a similar operator for your situation? Link to comment https://forums.phpfreaks.com/topic/28463-stopping-database-search/#findComment-130261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.