daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jan 25th, 2016 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $servername = "localhost";
  2.     $username = "";
  3.     $password = "";
  4.     $dbname = "test";
  5.    
  6.     $conn = new mysqli($servername, $username, $password, $dbname);
  7.  
  8.     if (!$conn) {
  9.         echo "Connection failure: " . mysqli_connect_error();
  10.         die('Failed to connect: ' . mysql_error());
  11.     }
  12.     echo "Connected successfully to: <b>$servername</b>";
  13.     echo "<br>";
  14.        
  15.     $sql = "CREATE TABLE MyGuests (
  16.         id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  17.         firstname VARCHAR(30) NOT NULL,
  18.         lastname VARCHAR(30) NOT NULL,
  19.         email VARCHAR(50),
  20.         reg_date TIMESTAMP
  21.     )";
  22.     if (mysqli_query($conn, $sql)) {
  23.         echo "Table MyGuests created successfully";
  24.     } else {
  25.         echo "Error creating table: " . mysqli_error($conn);
  26.     }
  27.  
  28.     mysqli_close($conn);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top