PHP/MySQL Database/Choose Database

Материал из Web эксперт
Перейти к: навигация, поиск

Selecting a Database

<?php
  $host="mysql153.secureserver.net";
  $uname="wbex";
  $pass="password";
  
  $connection= mysql_connect ($host, $uname, $pass);
  
  if (!$connection) {
     die ("A connection to the server could not be established!"); 
  }
  
  $result=mysql_select_db ("wbex");
  
  if (! $result) {
     die ("database could not be selected");
  }
     
  echo "Database wbex is ready for use.";
?>