<?php
$mysqli = new mysqli("localhost", "root", "", "constra_db");
if ($mysqli->connect_error) die("Connection failed: " . $mysqli->connect_error);

$result = $mysqli->query("SELECT * FROM categories");
while($row = $result->fetch_assoc()) {
    print_r($row);
}
$mysqli->close();
?>
