Jump to content

Repeat rows plus add a number


2tonejoe

Recommended Posts

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.?

Link to comment
https://forums.phpfreaks.com/topic/62784-repeat-rows-plus-add-a-number/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.