Advertisement
Guest User

Untitled

a guest
Feb 12th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "username";
  4. $password = "password";
  5.  
  6. // Create connection
  7. $conn = mysqli_connect($servername, $username, $password);
  8. // Check connection
  9. if (!$conn) {
  10. die("Connection failed: " . mysqli_connect_error());
  11. }
  12.  
  13. // Create database
  14. $sql = "CREATE DATABASE myDB";
  15. if (mysqli_query($conn, $sql)) {
  16. echo "Database created successfully";
  17. } else {
  18. echo "Error creating database: " . mysqli_error($conn);
  19. }
  20.  
  21. mysqli_close($conn);
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement