To make a connection with a mySql database :
- Use wamp server, to download it click here. Install it.
- Start it, left click on the icon in the task bar ( I say left click
)
- PHP > PHP Extensions > select php_mysql
- In your php page or classe use this code :// mySql connection
$login_mysqlServer=USER; // your connection user
$pwd_mysqlServer=PWD’; // password connection user
$chaine_connexion_mysqlServer = IP_SERVER; // Name or IP of the databasse server
$bd_mysqlServer=DB_NAME; // Database name
$con_mysqlServer = mysql_connect($chaine_connexion_mysqlServer, $login_mysqlServer, $pwd_mysqlServer) or die(“Impossible to make connection with mySQL Server “);
$selected = mysql_select_db($bd_mysqlServer, $con_mysqlServer) or die(“Impossible to make connection with mySQL Server “); - Congratulation… You made a connection with your mySql database by using PHP.
See also :
- How to make your first php page?
- How to send and receive parameters in PHP?
- How to make a connection with a sqlServer database by using PHP?