Selecting a Database : Choose Database « MySQL Database « PHP






Selecting a Database


<?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!"); 
  }
  
  $result=mysql_select_db ("java2s");
  
  if (! $result) {
     die ("database could not be selected");
  }
     
  echo "Database java2s is ready for use.";
?>
           
       








Related examples in the same category