plehmurof Posted June 5, 2010 Share Posted June 5, 2010 Help :'( I am populating a table from information held in a mysql table and using while ( $row = mysqli_fetch_array($result)) { and this works well, but one of the fields is a number of the number items, there the row has to be repeated that many times. Tried while ($num = mysqli_fetch_array($number){ for ($i=0; $i = $num['qty']; $i++) { while ($row = mysqli_fetch_array($result) { -- body of the table here --- }}} Any help please Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/ Share on other sites More sharing options...
dabaR Posted June 5, 2010 Share Posted June 5, 2010 Looks like what you want is: while ($row = mysqli_fetch_array($result) { for ($i=0; $i = $row['qty']; $i++) { //row } } Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068111 Share on other sites More sharing options...
ignace Posted June 5, 2010 Share Posted June 5, 2010 for ($i=0; $i = $row['qty']; ..) ? Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068119 Share on other sites More sharing options...
dabaR Posted June 5, 2010 Share Posted June 5, 2010 Heh Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068120 Share on other sites More sharing options...
plehmurof Posted June 6, 2010 Author Share Posted June 6, 2010 sorry but your solution did not appear to work, just repeated the first line of the table an infinate number of times. Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068470 Share on other sites More sharing options...
ignace Posted June 6, 2010 Share Posted June 6, 2010 sorry but your solution did not appear to work, just repeated the first line of the table an infinate number of times. I pointed that out here. It's $i < $row['qty'] Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068471 Share on other sites More sharing options...
plehmurof Posted June 6, 2010 Author Share Posted June 6, 2010 thanks that got it, sorry i missed your solution with the < Link to comment https://forums.phpfreaks.com/topic/203940-duplicating-rows-in-a-table/#findComment-1068476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.