Create multi-row tables in PHP using MySQL -
i'm trying create following:
but current code has given me:
the part in white code below, , part in black when add in 2 more <td>
rows. problem can't 3 pieces of data per row created - vertically or horizontally.
$result = mysqli_query($con,"select * show_listing"); while($row = mysqli_fetch_array($result)) { echo "<table> <tr> <td>".$row['name']."'</td> </tr> </table>"; } mysqli_close($con);
it may simpler think know how this?
$c = 0; echo "<table>"; while($row = mysqli_fetch_array($result)) { if ($c%3 == 0) { if ($c) echo "</tr>"; echo "<tr>"; } echo "<td>".$row['name']."</td>"; $c++; } if ($c) echo "</tr>"; echo "</table>";
Comments
Post a Comment