Max45 Posted April 12, 2020 Share Posted April 12, 2020 (edited) The following code is showing my result horizontally and I want to show them vertically $id = $_GET['id']; $sql = "SELECT * FROM users WHERE id = $id"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<table align=\"center\">; <tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> <th>Email</th> <th>Join Date</th> </tr>"; // output data of each row while($row = $result->fetch_assoc()) { echo "<tr> <td>".$row["id"]."</td> <td>".$row["fname"]."</td> <td>".$row["lname"]."</td> <td>".$row["email"]."</td> <td>".$row["reg_date"]."</td> </tr>"; } echo "</table>"; } Any idea? Thanks in advance Edited April 12, 2020 by Max45 Quote Link to comment Share on other sites More sharing options...
NotSunfighter Posted April 12, 2020 Share Posted April 12, 2020 Not going to code this, but off the top of my head I would use Flex-box and not a table. Set it up to display as you have it above (horizon.) . Then set the flex order by row to instantly create a vertical table. Quote Link to comment Share on other sites More sharing options...
Max45 Posted April 12, 2020 Author Share Posted April 12, 2020 3 hours ago, NotSunfighter said: Not going to code this, but off the top of my head I would use Flex-box and not a table. Set it up to display as you have it above (horizon.) . Then set the flex order by row to instantly create a vertical table. You mean like this? th, td { text-align: left display: flexbox; flex-order: 1; } th, td { text-align: left display: flexbox; flex-order: 1; } Quote Link to comment Share on other sites More sharing options...
NotSunfighter Posted April 13, 2020 Share Posted April 13, 2020 Stop using tables. Use divs for the cells. Put them in a container and flex that. 1 Quote Link to comment Share on other sites More sharing options...
Max45 Posted April 14, 2020 Author Share Posted April 14, 2020 13 hours ago, NotSunfighter said: Stop using tables. Use divs for the cells. Put them in a container and flex that. Thaaaaaaaaaaaaaaaaaaaankyou , You really save my time for this advice. It worked Thanks Quote Link to comment Share on other sites More sharing options...
NotSunfighter Posted April 14, 2020 Share Posted April 14, 2020 no problem Your Welcome 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.