Untitled

 avatar
unknown
php
3 years ago
818 B
1
Indexable
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname="cms";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$dbname);
mysqli_set_charset($conn,"utf8");
$result = $conn->query("select * from product");
?>
<html>
    <head>
        <title>table</title>
    </head>
    <body>
        <table>
            <tr>
            <th> id</th>
            <th> title</th>
            <th> price</th>
            </tr>
           <?php
           while ($row = $result->fetch_assoc()) {
?>
            
            <tr>
            <td> <?= $row['ID']?></td>
            <td> <?= $row['title']?></td>
            <td> <?= $row['price']?></td>
 
            </tr>
            <?php
   
}
            ?>
        </table>
    </body>
</html>