Jump to content

Recommended Posts

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 by Max45

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.

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;
}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.