Anslutning till mySQL

A connectionstring for mysql with error messages can look as below:

1
2
3
4
5
6
//Connect to the server with your user
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
             or die("Could not connect to database: " . mysql_error());
 
// Select database
mysql_select_db("my_database", $link) or die("Could not select the database");