html - Make Looping Table PHP -


i want make looping table in project.

here code:

<!doctype html>   <html>   <body>   <table align="left" border="1" cellpadding="3" cellspacing="0">   <?php   for($i=1;$i<=6;$i++)   {   echo "<tr>";   ($j=1;$j<=5;$j++)     {     echo "<td>$i"</td>";     }     echo "</tr>";     }   ?>   </table>   </body>   </html> 

i want make looping table auto number in first column. response this: enter image description here

can 1 tell me how can make in first column?

expected result:

enter image description here

then move $i outside of inner loop , add empty table data. reduce inner loop iteration 1 count:

<!doctype html>   <html>   <body>   <table align="left" border="1" cellpadding="3" cellspacing="0">   <?php   for($i=1;$i<=6;$i++)   {   echo "<tr>";   echo "<td>$i</td>";   ($j=2;$j<=5;$j++)     {     echo "<td>&nbsp;</td>";     }     echo "</tr>";     }   ?>   </table>   </body>   </html> 

note: typo in question - echo "<td>$i"</td>"; echo "<td>$i</td>";


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -