how-to-connect-mysql-database-in-php-using-xampp-php-guru

Hello Friends, Welcome to php-guru.com. If you are new in PHP and you don’t know how to connect MySQL database in PHP using xampp? So friends then this video is only for you don’t skip the video and watch the full video.

After Watching Video Follow Below Given Steps :-

Step 1: First Start Xampp Panel, then open browser. then in browser URL. http://localhost/phpmyadmin/

Step 2: Create a new database, give a name as a test.

Step 3: Now Create a new folder in htdocs and give the name as a test. In the test, folder create a new file with the name db.php

Step 4: Now copy all code given below and paste in db.php file & save the file

Step 5: type these URLs in the browser to run the program http://localhost/test/db.php

If your connection did successfully you will see connected. if your connection is not done with a database you will see a connection failed error.

db.php

<?php
$servername="localhost";
$username="root";
$password="";
$dbname="databasename"; //Enter your database name
$conn=new mysqli($servername,$username,$password,$dbname);
if($conn->connect_error)
{
    die("connection failed".$connect_error);
}else{
    echo "Connected Successfully";
}
?>

If Anyone Need Help or Some Error Occur Join this Group By Clicking on Link. I Will Help You.

Whatsapp Group:-

https://chat.whatsapp.com/HCMYd64etCyKKUJqfxIwRi

Facebook Group:-
https://www.facebook.com/groups/2196861133786438

Thank You.

PHP-GURU

One thought on “How To Connect Mysql Database in PHP using Xampp”
  1. I appreciate, cause I found just what I was looking for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Bye

Leave a Reply

Your email address will not be published. Required fields are marked *