mysqli database connection using xampp

Step 1) Search  Xampp in Windows Search then Xampp Contol panel show like these. 


xampp-control-panel,mysqli-database-connection
Xampp Control Panel


Step 2) Then Click  Start  Apache and MySQL button.

mysqli-start-xampp,mysqli-database-connection
Start MySQL & apache


Step 3) Open a Browser and type  https://localhost/phpmyadmin

Step 4) Click on New -> Database Name and click on create button.

In these example. new -> crud_ajax 


Step 5) Go in Computer Drive where you Install xampp 
Click  Xampp ->  htdocs ->  Create New Folder

In these example. Xampp -> htdocs -> crud_ajax


Step 6) Create new file in that folder and name as db.php

In these example. Xampp -> htdocs -> crud_ajax -> db.php


Step 7)  And write these code in  db.php file.

db.php

<?php

$servername="localhost";
$username="root";
$password="";
$dbname="crud_ajax";

$conn=new mysqli($servername,$username,$password,$dbname);

if($conn->connect_error)
{
    die("connection failed".$connect_error);

}else{

    echo "Connected Successfully";
}

?>


Step 8) Open a Browser and type https://localhost/crud_ajax/db.php


Output Screen:-

mysqli-connection,mysqli-database-connection-xampp
connection successfull














No comments:

Post a Comment