livewirerules Posted August 10, 2010 Share Posted August 10, 2010 $count=0; $numb=50; foreach ($sepkeys as $dbkey) { for ($page=10;$page<=$numb;$page=$page + 10) { // the if block $count=$count+1; } } I am trying to maintain a separate a count for each key number in the above code. Eg: key- 574, it searches from pages 10-50 and increments the count by 1. The problem that I have is the count is continuous. After searching for the first key and moves on to the next key and them I need the count to start from the beginning rather than being continuous. Eg: key-874 : count = 22, in my case the next key 875 : the count is 23 I need to make it 1. I removed the if block and several lines because the code is too long. Can someone please suggest me a way how to do it Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 10, 2010 Share Posted August 10, 2010 Um, kind of confused, but like this: $count=0; $numb=50; foreach ($sepkeys as $dbkey) { for ($page=10;$page<=$numb;$page=$page + 10) { // the if block $count=$count+1; } $count = 0; } You need a better explanation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.