function mysql_connect() establishes an initial connection with the MySQL server. : mysqli_connect « MySQL Database « PHP






function mysql_connect() establishes an initial connection with the MySQL server.

 
int mysql_connect([string hostname [:port] [:/path/to/socket] [, string username][, string password])


<?
@mysql_connect("localhost", "web", "aaaa") or die("Could not connect to MySQLserver!");
?>
In this case, localhost is the server host, web is the username, and aaaa is the password. 
The @ will suppress any error message that results from a failed attempt.
  
  








Related examples in the same category

1.In PHP 5 using the MySQLi extension
2.Discovering Which Extension Is Being Used
3.MySQL Connection Test
4.custom-error-messages.php