PHP code to establish a connection with MySQL : Database Connection « MySQL Database « PHP






PHP code to establish a connection with MySQL


  <?php
  $host="mysql153.secureserver.net";
  $uname="java2s";
  $pass="password";
  
  $connection= mysql_connect ($host, $uname, $pass);
  if (! $connection) {
    die ("A connection to the Server could not be established!");
  } else {
    echo "User root logged into to MySQL server ",$host," successfully.";
  }
  ?>



           
       








Related examples in the same category

1.Close database connections