Advertisement
Guest User

Untitled

a guest
Feb 20th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <html lang="en">
  2. <body>
  3. <?php
  4. $servername = "localhost";
  5. $username = "username";
  6. $password = "password";
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password);
  9. // Check connection
  10. if ($conn->connect_error)
  11. {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14. // Create database
  15. $sql = "CREATE DATABASE myDB";
  16. if ($conn->query($sql) === TRUE)
  17. {
  18. echo "Database created successfully";
  19. }
  20. else
  21. {
  22. echo "Error creating database: " . $conn->error;
  23. }
  24. $conn->close();
  25. $servername = "localhost";
  26. $username = "username";
  27. $password = "password";
  28. $dbname = "myDB";
  29.  
  30. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<html lang="en">
  31. <body>
  32. <?php
  33. $servername = "localhost"' at line 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement