Advertisement
Guest User

Connect to mysql with PHP

a guest
Mar 29th, 2016
1,482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. function connectToDatabase()
  2. {
  3. $server = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $database = "tutorial";
  7.  
  8. $connection = mysql_connect($server, $username, $password, $database);
  9.  
  10. if (!$connection)
  11. {
  12. die ("could not connect to databse:" . mysql_error());
  13. }
  14.  
  15. echo "Connection Succesful";
  16.  
  17. return $connection;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement