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 Quote Link to comment 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 } } Quote Link to comment Share on other sites More sharing options...
ignace Posted June 5, 2010 Share Posted June 5, 2010 for ($i=0; $i = $row['qty']; ..) ? Quote Link to comment Share on other sites More sharing options...
dabaR Posted June 5, 2010 Share Posted June 5, 2010 Heh Quote Link to comment 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. Quote Link to comment 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'] Quote Link to comment 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 < 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.