Question: Where do I put code for a table around the customerID? Also how do i put in order inside PHP?

```
<html>
<head>
</head>
<body>

    <?
    $options = array(
    PDO::MYSQL_ATTR_INIT_COMMAND=> 'SET NAMES utf8',

    );
    $dsn        = 'mysql:host=localhost;dbname=username';
    $password   = 'password';
    $username   = 'username';
    $db         = new PDO($dsn, $username, $password, $options);

    $query  = "SELECT * FROM customers";
    $stmt   = $db->prepare($query);
    $stmt->execute();

    while($row = $stmt->fetch(PDO::FETCH_ASSOC))

    {

    $id         =$row['customerid'];
    $name       =$row['name'];
    echo "Customer ID: $customerid, Name: $name<br />"; 
}

?>      
</body>  
</html>

```

Can someone help me on this?

Answer: 
Use `ORDER BY COLUMN_NAME` for order and default order is ascending.

Use `<table border=1>` for applying table structure with border.

Try below code.

```
<html>
    <head>
    </head>
    <body>

        <?php
            $options = array(
                PDO::MYSQL_ATTR_INIT_COMMAND=> 'SET NAMES utf8',

            );
            $dsn        = 'mysql:host=localhost;dbname=username';
            $password   = 'password';
            $username   = 'username';
            $db         = new PDO($dsn, $username, $password, $options);

            $query  = "SELECT * FROM customers ORDER BY name";
            $stmt   = $db->prepare($query);
            $stmt->execute();

            echo "<table border=1>";
            echo "<tr>";
            echo "<th>Customer ID</th>";
            echo "<th>Name</th>";
            echo "</tr>";

            while($row = $stmt->fetch(PDO::FETCH_ASSOC))
            {
                echo "<tr>";
                $id         =$row['customerid'];
                $name       =$row['name'];
                echo "<td>Customer ID: $customerid</td>"; 
                echo "<td>Name: $name</td>";
                echo "</tr>";
            }
            echo "</table>";
        ?>      
       </body>  
       </html>

```
Do you want to show your customer ID and name in tabular format? 

Try this:

```
<table border="1"> 

 <tr>
    <th>Customer ID</th>
    <th>Name</th>
 </tr>

<?php
   $options = array(
      PDO::MYSQL_ATTR_INIT_COMMAND=> 'SET NAMES utf8',

    );

    /*Other code*/

    while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
 ?>
 <tr>
    <td><?php echo $row['customerid']; ?> </td>
    <td><?php echo $row['name'] ?> </td>
 </tr>
 <?php } ?>

</table>

```