The mysql_connect () function locally creates a connection to the MySQL server
/*/$link = mysql_connect (' localhost ', ' root ', ') or Die (' cannot connect to the database server!) The database may not be started. or the user name password is wrong! '. Mysql_error ()); if ($link) { echo "database connection succeeded!") ;}
mysql_select_db () function connect MySQL database test
/** * Use mysql_connect () function to connect MySQL database*/$link=mysql_connect(' localhost ', ' root ', ') or die(' cannot connect to the database server!) The database may not be started or the user name password is incorrect! '.Mysql_error());//connect to MySQL server$db _selected = mysql_select_db (' Test ', $link); Connecting to a database Db_database18if($db _selected){ Echo"Database connection succeeded!";}Else{ Echo' Database connection failed! ';}?>
mysql_query () function connect MySQL database Test
/*/$linkmysql_connectdie (' cannot connect to the database server!) may be the database is not started, or the user name password is incorrect! '. Mysql_error ()); // connect to MySQL server $db _selected = mysql_query (' Use test ', $link); Connection data See testif($db _selected) { echo ' database selected successfully! ' ;}? >
Common MySQL Functions