Mega Code Archive

 
Categories / Php / MySQL Database
 

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.