Connect MYSQL Database using php step by step?
1) Create a Database.
2) Create a new file in Notepad++ or other text editor that you are using.
Create a Database.
- Go to your phpmyadmin.
- Click on Databases at the top.
- Enter the Database name.
- Click create button
Create a new file in Notepad++ or other text editor that you are using.
- Copy and Paste this code in to your text editor like(Notepad++, Sublime or other text editor that you are using )
$db_name=”db_conn”; //Here enter your database name
$conn=new mysqli($hostname, $username, $password, $db_name) or die(‘could not connect’);
- Then change your database name($db_name=”Here enter your database name”) and save it(Ctrl+S).
- Go to your browser refresh it
- Your database will be connected