Skip to content

Instantly share code, notes, and snippets.

@domosedov
Created September 14, 2018 06:58
Show Gist options
  • Save domosedov/cd22b33dd9136881c3092e2e4cfa4326 to your computer and use it in GitHub Desktop.
Save domosedov/cd22b33dd9136881c3092e2e4cfa4326 to your computer and use it in GitHub Desktop.
фрагмент кода, позволяющий проверить в браузере факт успешного создания таблицы
<?php
require_once 'login.php';
$conn = new mysqli($hn, $un, $pw, $db);
if ($conn->connect_error) die($conn->connect_error);
$query = "DESCRIBE <Имя таблиц>";
$result = $conn->query($query);
if (!$result) die ("Database access failed: " . $conn->error);
$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)
{
$result->data_seek($j);
$row = $result->fetch_array(MYSQLI_NUM);
echo "<tr>";
for ($k = 0 ; $k < 4 ; ++$k) echo "<td>$row[$k]</td>";
echo "</tr>";
}
echo "</table>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment