Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "mysql";
- $dbname = "myDB";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- // sql to create table
- $sql = "CREATE TABLE MyTable (
- id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- uname VARCHAR(30) NOT NULL,
- msg TINYTEXT NOT NULL,
- reg_date TIMESTAMP
- )";
- if (mysqli_query($conn, $sql)) {
- echo "Table MyGuests created successfully";
- } else {
- echo "Error creating table: " . mysqli_error($conn);
- }
- mysqli_close($conn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement