$servername = "localhost"; $username = "root"; $password = ""; $dbname = "TB"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id FROM COMP"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<table><tr><th>ID</th></tr>"; // output data of each row while($row = $result->fetch_assoc()) { echo "<tr><td>" . $row["id"]. "</td></tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close(); ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)