Skip to content

Instantly share code, notes, and snippets.

@barmgeat
Last active December 27, 2020 19:26
Show Gist options
  • Save barmgeat/8b340725176e266d817d597a0965cd91 to your computer and use it in GitHub Desktop.
Save barmgeat/8b340725176e266d817d597a0965cd91 to your computer and use it in GitHub Desktop.
<?php
// sql to create table
$sql = "CREATE TABLE MyGuests (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)";
if ($conn->query($sql) === TRUE) {
echo "Table MyGuests created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment