This will show how to connect MySQL database in PHP. You can use following code to connect database.
<?php $con = mysqli_connect("localhost","root","projectpassword","dbname"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL database.."; exit(); }
Here localhost is the server name, root is mysql server user name, projectpassword is database server password and dbname is the name of the database.
Leave a reply