Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php if ($mysqli->connect_error) die("Fatal Error"); $query = "DESCRIBE cats"; $result = $mysqli->query($query); if (!$result) die ("Database access failed"); $rows = $result->num_rows; echo "<table><tr><th>Column</th><th>Type</th><th>Null</th><th>Key</th></tr>"; for ($j = 0 ; $j < $rows ; ++$j) { $row = $result->fetch_array(MYSQLI_NUM); echo "<tr>"; for ($k = 0 ; $k < 4 ; ++$k) echo "<td>" . htmlspecialchars($row[$k]) . "</td>"; echo "</tr>"; } echo "</table>"; ?>
Copy Clear