I am trying to create a cars table in MySQL, here is my code:
<?php
$sql = "CREATE TABLE cars (
regnr varchar(10),
make varchar(30),
yearmodel int,
mileage int
)";
if (mysqli_query($connection, $sql)) {
echo '<p>Table created</p>';
} else {
echo '<p>Failed: check the sql: ';
echo $sql;
}
?>
But it resulted in an error:
Connection ok
Failed: check the sql: CREATE TABLE cars ( regnr varchar(10), make varchar(30), yearmodel int, mileage int)
How can I make this code works?