2tonejoe Posted August 1, 2007 Share Posted August 1, 2007 ok. I have this: while($row = mysql_fetch_array( $result )) { echo "<tr><td>"; echo " ".$row['user_name']." "; echo "</td><td>"; echo " ".$row['user_facility']." "; echo "</td><td>"; echo " ".$row['user_position']." "; echo "</td><td>"; echo " ".$row['user_email']." "; echo "</td><td>"; echo " ".$row['user_contact']." "; echo "</td><td>"; echo " ".$row['update_date']." "; echo "</td><td>"; echo " <a href=\"index.php?page=edit-a-user&id=".$row['user_id']."\">edit</a> " ; echo "</td></tr>"; which works GREAT! I want to now use the above code, but instead of fetching the array, I want to echo the above table as many times as and integer. For instance; if the integer inside of the variable is 189 ($theInt = 189) the repeat that row from above 189 times and include dynamic number row as well.. . . see below for the row explanation: echo " ".$theInt + 1; echo "</td><td>"; so I would like the above code print the number for each time it builds a row. . . . does this make sense.? Quote Link to comment https://forums.phpfreaks.com/topic/62784-repeat-rows-plus-add-a-number/ Share on other sites More sharing options...
teng84 Posted August 1, 2007 Share Posted August 1, 2007 just add $counter++; inside the loop nad we you echo that it will give 0 to the No of loop its no up to you where to echo the $counter Quote Link to comment https://forums.phpfreaks.com/topic/62784-repeat-rows-plus-add-a-number/#findComment-312585 Share on other sites More sharing options...
2tonejoe Posted August 1, 2007 Author Share Posted August 1, 2007 I am not sure I understand you. . . . is $counter a system variable. . . or are you suggesting something else? Quote Link to comment https://forums.phpfreaks.com/topic/62784-repeat-rows-plus-add-a-number/#findComment-312586 Share on other sites More sharing options...
Barand Posted August 1, 2007 Share Posted August 1, 2007 <?php $theInt = 10; $counter = 0; while ($counter++ < $theInt) { echo "$counter : Hello world<br>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/62784-repeat-rows-plus-add-a-number/#findComment-312610 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.