Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2. $dbhost = 'localhost';
  3. $dbuser = 'usuario_root';
  4. $dbpass = 'senha_root';
  5.  
  6. $conn = new mysqli($dbhost, $dbuser, $dbpass);
  7. if($conn->connect_error )
  8. {
  9. die('Could not connect: %s' . $conn->connect_error);
  10. }
  11. echo "Connected successfullynn";
  12.  
  13.  
  14. $sql = "CREATE DATABASE novobd";
  15.  
  16. if($conn->query($sql)===TRUE){
  17.  
  18. echo "Created the databasen";
  19.  
  20. }
  21.  
  22. else {
  23. echo "Failed to create the database: ".$conn->error;
  24. }
  25.  
  26. //Close the database
  27. $conn->close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement