SlideShare a Scribd company logo
17
Most read
18
Most read
19
Most read
A Step by Step approach for
PHP-MySQL Connectivity Using XAMPP Server
Step I
Downloading and
Installing XAMPP
What we Require?
1. XAMPP Server(32 bit/64 bit)
2. Editor(Notepad++/Netbeans)
3. Any Latest Browser(Internet
Explorer/Chrome/Mozila Firefox)
• Download Latest Version of XAMPP(32/64 bit,
according to your machine) from apachefriends.org
• An .exe file will be downloaded after few minutes.
•
• Now Double Click on Downloaded exe file of XAMPP. It
will be started to install.
• There can a warning message shown as in following
snapshot. Just click on Ok (because it is related with user
account control, will be discussed later sometime).
PHP-MySQL Database Connectivity Using XAMPP Server
• After few minutes, XAMPP will be installed.XAMPP comes with its
Control Panel. This control panel is used to start/stop any service
directly. It will prompt to open Control panel. You can open now or
later on. I will open to check the installation status of XAMPP.
• After clicking on finish, Save appropriate language.
• Now Following snapshot shows XAMPP control panel.
• Now start Apache and MySQL services by clicking on Start Buttons shown
in front of them.Now, lets check the working of server.
• Open any Browser.(I will open Chrome).
• Type localhost in address bar and hit enter.The following screen shows
successful working of XAMPP.
Step II
Creating Database and Table in
MySQL
• Open XAMPP Control Panel.It can be opened by moving to
C:xampp directory.Serach xampp-control file and click on it.
• Now click on Admin button in front of MySQL Module.It will
open MySQL database user interface in default browser as
shown.
• You can create and manage databases in this interface. It can
be also openend by typing http://localhost/phpmyadmin/ in
address bar.
MySQL Database User Interface
Creating Database
• Click on database Tab.
• Now type name of database you want to create.I type
user_account. Then click on create button.
• Now new database with name user_accounts will be created
and shown on the top in hierarchical way.
Creating Table
• Now give a tablename to be created and select number of columns. Click
on go to proceed further.
• I have typed two columns say, user_id and user_passwd for my table.Click
on save to process query. A table will be created as shown.
Step III
Connecting PHP and MYSQL to
insert into table
• Open Notepad++ to type following
coding.Save this file to C:xampphtdocs for
proper working.
Form Coding
Form Coding (user_register.php)
</head>
<body>
<form id="user_register" method="get" >
<div style="text-align:center">
<span class="label success" height="100%"><font size="4">Enter User
Id</font></span>
<input type="text" id="un" name="uname" placeholder="Enter User Name">
<br/>
<span class="label success" height="100%"><font size="4">Enter User
Id</font></span>
<input type="password" id="up" name="upasswd" placeholder="Enter
Password">
<br/><br/>
<input type="submit" name="submit" value="Add User">
Form Coding (user_register.php) cont.
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user_accounts";
//creating connection
$con = new mysqli($servername, $username, $password, $dbname);
//checking connection status
if($con->connect_error)
{
die("Connection Failure:".$conn->connect_error);
return false;
}
Form Coding (user_register.php) cont.
if(isset($_GET['submit']))
{
$u_name=$_GET['uname'];
$u_passwd=$_GET['upasswd'];
$add_qry="insert into
users_tabs(user_id,user_passwd)values('$u_name','$u_passwd')";
if ($con->query($add_qry) === TRUE)
{
echo "User Added"."<br/>";
}
else
{echo "Error: " . $add_qry . "<br>" . $con->error;}
unset($_GET['submit']);
$con->close();
}
?>
</div></form><body></html>
Output
Database Snapshot
Conclusion
• So, hence you can execute every type of query
such as insert, select, delete and update in
MySql.
Thanks

More Related Content

PPTX
Database Connectivity in PHP
Taha Malampatti
 
PPTX
Introduction to xampp
Jin Castor
 
PPT
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
PPTX
Introduction to php
shanmukhareddy dasi
 
PPT
PHP variables
Siddique Ibrahim
 
PPTX
Php basics
Jamshid Hashimi
 
Database Connectivity in PHP
Taha Malampatti
 
Introduction to xampp
Jin Castor
 
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Introduction to php
shanmukhareddy dasi
 
PHP variables
Siddique Ibrahim
 
Php basics
Jamshid Hashimi
 

What's hot (20)

PPTX
Introduction to php
Taha Malampatti
 
PDF
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
 
PPT
Php Ppt
vsnmurthy
 
PPT
PHP - DataType,Variable,Constant,Operators,Array,Include and require
TheCreativedev Blog
 
PPT
structure and union
student
 
PPT
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
PPSX
ASP.NET Web form
Md. Mahedee Hasan
 
PPTX
Unit 1 introduction to web programming
zahid7578
 
PPTX
Method overloading
Lovely Professional University
 
PDF
Web Development Course: PHP lecture 1
Gheyath M. Othman
 
PPTX
Php operators
Aashiq Kuchey
 
PPTX
Form Validation in JavaScript
Ravi Bhadauria
 
PPSX
Php and MySQL
Tiji Thomas
 
PPTX
HTML Forms
Ravinder Kamboj
 
PPT
Php mysql ppt
Karmatechnologies Pvt. Ltd.
 
PPTX
Php
Shyam Khant
 
PPT
MySQL and its basic commands
Bwsrang Basumatary
 
PDF
Php introduction
krishnapriya Tadepalli
 
Introduction to php
Taha Malampatti
 
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
 
Php Ppt
vsnmurthy
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
TheCreativedev Blog
 
structure and union
student
 
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
ASP.NET Web form
Md. Mahedee Hasan
 
Unit 1 introduction to web programming
zahid7578
 
Method overloading
Lovely Professional University
 
Web Development Course: PHP lecture 1
Gheyath M. Othman
 
Php operators
Aashiq Kuchey
 
Form Validation in JavaScript
Ravi Bhadauria
 
Php and MySQL
Tiji Thomas
 
HTML Forms
Ravinder Kamboj
 
MySQL and its basic commands
Bwsrang Basumatary
 
Php introduction
krishnapriya Tadepalli
 
Ad

Similar to PHP-MySQL Database Connectivity Using XAMPP Server (20)

PPTX
MySQL with PHP
MsSJeyalakshmiVelsUn
 
ODP
Php modul-3
Kristophorus Hadiono
 
PPTX
Web Application Development using PHP Chapter 6
Mohd Harris Ahmad Jaal
 
PDF
mush With Xampp
Dr.M.G.R. University,chennai
 
PDF
Installing configuringdevelopingwithxampp
vimalnambiar
 
PPTX
PHP tutorials , php tutorials for beginners , tutorials for php
aimaq9a
 
PDF
Php 2
tnngo2
 
PPTX
3-Chapter-Edit.pptx debre tabour university
alemunuruhak9
 
PPTX
PHP DATABASE MANAGEMENT.pptx
CynthiaKendi1
 
PDF
4th quarter 17 php & my sql registration page
Esmeraldo Jr Guimbarda
 
PPTX
Php basics
Egerton University
 
PPTX
Learn PHP Lacture2
ADARSH BHATT
 
PPTX
Chapter 3.1.pptx
mebratu9
 
PPT
Php classes in mumbai
aadi Surve
 
PPT
PHP - Getting good with MySQL part II
Firdaus Adib
 
PPT
Download It
webhostingguy
 
PPTX
SRMS 5th Sem Minor project.pptx
Chudail1
 
PPT
P H P Part I I, By Kian
phelios
 
PDF
Php simple
PrinceGuru MS
 
MySQL with PHP
MsSJeyalakshmiVelsUn
 
Web Application Development using PHP Chapter 6
Mohd Harris Ahmad Jaal
 
Installing configuringdevelopingwithxampp
vimalnambiar
 
PHP tutorials , php tutorials for beginners , tutorials for php
aimaq9a
 
Php 2
tnngo2
 
3-Chapter-Edit.pptx debre tabour university
alemunuruhak9
 
PHP DATABASE MANAGEMENT.pptx
CynthiaKendi1
 
4th quarter 17 php & my sql registration page
Esmeraldo Jr Guimbarda
 
Php basics
Egerton University
 
Learn PHP Lacture2
ADARSH BHATT
 
Chapter 3.1.pptx
mebratu9
 
Php classes in mumbai
aadi Surve
 
PHP - Getting good with MySQL part II
Firdaus Adib
 
Download It
webhostingguy
 
SRMS 5th Sem Minor project.pptx
Chudail1
 
P H P Part I I, By Kian
phelios
 
Php simple
PrinceGuru MS
 
Ad

Recently uploaded (20)

PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
oapresentation.pptx
mehatdhavalrajubhai
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
Exploring AI Agents in Process Industries
amoreira6
 
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 

PHP-MySQL Database Connectivity Using XAMPP Server

  • 1. A Step by Step approach for PHP-MySQL Connectivity Using XAMPP Server
  • 3. What we Require? 1. XAMPP Server(32 bit/64 bit) 2. Editor(Notepad++/Netbeans) 3. Any Latest Browser(Internet Explorer/Chrome/Mozila Firefox)
  • 4. • Download Latest Version of XAMPP(32/64 bit, according to your machine) from apachefriends.org • An .exe file will be downloaded after few minutes. •
  • 5. • Now Double Click on Downloaded exe file of XAMPP. It will be started to install. • There can a warning message shown as in following snapshot. Just click on Ok (because it is related with user account control, will be discussed later sometime).
  • 7. • After few minutes, XAMPP will be installed.XAMPP comes with its Control Panel. This control panel is used to start/stop any service directly. It will prompt to open Control panel. You can open now or later on. I will open to check the installation status of XAMPP. • After clicking on finish, Save appropriate language. • Now Following snapshot shows XAMPP control panel.
  • 8. • Now start Apache and MySQL services by clicking on Start Buttons shown in front of them.Now, lets check the working of server. • Open any Browser.(I will open Chrome). • Type localhost in address bar and hit enter.The following screen shows successful working of XAMPP.
  • 9. Step II Creating Database and Table in MySQL
  • 10. • Open XAMPP Control Panel.It can be opened by moving to C:xampp directory.Serach xampp-control file and click on it. • Now click on Admin button in front of MySQL Module.It will open MySQL database user interface in default browser as shown. • You can create and manage databases in this interface. It can be also openend by typing http://localhost/phpmyadmin/ in address bar.
  • 11. MySQL Database User Interface
  • 12. Creating Database • Click on database Tab. • Now type name of database you want to create.I type user_account. Then click on create button. • Now new database with name user_accounts will be created and shown on the top in hierarchical way.
  • 13. Creating Table • Now give a tablename to be created and select number of columns. Click on go to proceed further. • I have typed two columns say, user_id and user_passwd for my table.Click on save to process query. A table will be created as shown.
  • 14. Step III Connecting PHP and MYSQL to insert into table
  • 15. • Open Notepad++ to type following coding.Save this file to C:xampphtdocs for proper working.
  • 17. Form Coding (user_register.php) </head> <body> <form id="user_register" method="get" > <div style="text-align:center"> <span class="label success" height="100%"><font size="4">Enter User Id</font></span> <input type="text" id="un" name="uname" placeholder="Enter User Name"> <br/> <span class="label success" height="100%"><font size="4">Enter User Id</font></span> <input type="password" id="up" name="upasswd" placeholder="Enter Password"> <br/><br/> <input type="submit" name="submit" value="Add User">
  • 18. Form Coding (user_register.php) cont. <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "user_accounts"; //creating connection $con = new mysqli($servername, $username, $password, $dbname); //checking connection status if($con->connect_error) { die("Connection Failure:".$conn->connect_error); return false; }
  • 19. Form Coding (user_register.php) cont. if(isset($_GET['submit'])) { $u_name=$_GET['uname']; $u_passwd=$_GET['upasswd']; $add_qry="insert into users_tabs(user_id,user_passwd)values('$u_name','$u_passwd')"; if ($con->query($add_qry) === TRUE) { echo "User Added"."<br/>"; } else {echo "Error: " . $add_qry . "<br>" . $con->error;} unset($_GET['submit']); $con->close(); } ?> </div></form><body></html>
  • 22. Conclusion • So, hence you can execute every type of query such as insert, select, delete and update in MySql.