MySQL is a very popular open-source relational database management system (RDBMS).
PHP(Hypertext Preprocessor) is a server scripting language and a powerful tool for making dynamic and interactive Web pages.
Steps for connecting the database(MySQL) in PHP:
To run php code you need a server which is provided by XAMPP. So install it first.
Then open the XAMPP control panel and start "APACHE" and "MySQL".
Then Click on the Admin of MySQL row.
This Interface will Open Up.
Create a new database by clicking on the "new" are left corner
Name it and configure it as per your schema.
Now in your project create a 'connect'(you can use any name) file with the extension ".php"
Then use the mysqli_connect () method by passing the appropriate parameter
<?php $connect = mysqli_connect("localhost","root","","voters") or die("connection failed"); if($connect){ echo "Connected"; } else{ echo "Not Connected"; } ?>
Save the file.
Now on the browser type "Localhost/Project_Name/connect.php", if it shows connected then you are good to go. Connection is successfully created.