petenaylor Posted December 16, 2010 Share Posted December 16, 2010 Hi all I have a string in an include file for a javascript lightbox value. I need this value to increase by one every time it loops. Here's my code: $fetchproducts = mysql_query(" SELECT * FROM `products` "); while($returnedProduct = mysql_fetch_array($fetchproducts)) { include('product-cell.php'); } The string is called $lightboxcount in the product-cell.php file Can I fit a ++ into the code above? Many thanks for your help Pete Link to comment https://forums.phpfreaks.com/topic/221874-adding-count-in-include-file/ Share on other sites More sharing options...
BlueSkyIS Posted December 16, 2010 Share Posted December 16, 2010 Can I fit a ++ into the code above? yes. Link to comment https://forums.phpfreaks.com/topic/221874-adding-count-in-include-file/#findComment-1148144 Share on other sites More sharing options...
petenaylor Posted December 16, 2010 Author Share Posted December 16, 2010 Cheers! Can you show me how? Link to comment https://forums.phpfreaks.com/topic/221874-adding-count-in-include-file/#findComment-1148146 Share on other sites More sharing options...
BlueSkyIS Posted December 16, 2010 Share Posted December 16, 2010 $rec_count = 0; while($returnedProduct = mysql_fetch_array($fetchproducts)) { $rec_count++; // etc.... Link to comment https://forums.phpfreaks.com/topic/221874-adding-count-in-include-file/#findComment-1148151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.