skrappy1979 Posted November 3, 2010 Share Posted November 3, 2010 I need to add a condition to a while() statement I have. It should run when $counter is less than the number of records in my $products array which has 5 products. I set $counter and $product_no to 0. I need to use the count() function to get the number of records. Does that make sense? Do ya'll need more info. Any help is Greatly appreciated. Ive referenced and searched but cant figure out how to incorporate it. Im still learning. Peace, Skrappy Link to comment https://forums.phpfreaks.com/topic/217629-count-question/ Share on other sites More sharing options...
MasterACE14 Posted November 3, 2010 Share Posted November 3, 2010 $products = array(); // your array here $recordCount = count($products); // count records $counter = 0; // set counter to zero $product_no = 0; // set product number to zero while($counter < $recordCount) { // do stuff? $counter++; } Link to comment https://forums.phpfreaks.com/topic/217629-count-question/#findComment-1129811 Share on other sites More sharing options...
skrappy1979 Posted November 3, 2010 Author Share Posted November 3, 2010 Awesome, Thx Link to comment https://forums.phpfreaks.com/topic/217629-count-question/#findComment-1129815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.