SlideShare ist ein Scribd-Unternehmen logo
1 von 23
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).
• 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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
Introduction to xampp
Introduction to xamppIntroduction to xampp
Introduction to xampp
 
Xampp installation
Xampp installation Xampp installation
Xampp installation
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Laravel
LaravelLaravel
Laravel
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 
Scripting Languages
Scripting LanguagesScripting Languages
Scripting Languages
 
Php forms
Php formsPhp forms
Php forms
 
Javascript
JavascriptJavascript
Javascript
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Php technical presentation
Php technical presentationPhp technical presentation
Php technical presentation
 
Web Development using HTML & CSS
Web Development using HTML & CSSWeb Development using HTML & CSS
Web Development using HTML & CSS
 

Ähnlich wie PHP-MySQL Database Connectivity Using XAMPP Server

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhostIIUM
 
PHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpPHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpaimaq9a
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Boxguest34a3a419
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows BoxJayanta Dash
 
WASPNEWServerDecoumentation
WASPNEWServerDecoumentationWASPNEWServerDecoumentation
WASPNEWServerDecoumentationJames Willis
 
Wamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationWamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationChetan Soni
 
4th quarter 17 php & my sql registration page
4th quarter   17 php & my sql registration page4th quarter   17 php & my sql registration page
4th quarter 17 php & my sql registration pageEsmeraldo Jr Guimbarda
 
How to Install a PHP Script in cPanel.pdf
How to Install a PHP Script in cPanel.pdfHow to Install a PHP Script in cPanel.pdf
How to Install a PHP Script in cPanel.pdfHost It Smart
 
How to Install Magento 2 On Wamp
How to Install Magento 2 On WampHow to Install Magento 2 On Wamp
How to Install Magento 2 On WampTecstub
 
Installation xampp and WordPress on localhost
Installation xampp and WordPress on localhostInstallation xampp and WordPress on localhost
Installation xampp and WordPress on localhostLuzan Baral
 
How to install word press on local server
How to install word press on local serverHow to install word press on local server
How to install word press on local serverHimanshi Garg
 
Install Word Press with xampp
Install Word Press with xamppInstall Word Press with xampp
Install Word Press with xamppMehdi Sharifirad
 
How to Install and Configure Drupal CMS
How to Install and Configure Drupal CMSHow to Install and Configure Drupal CMS
How to Install and Configure Drupal CMSdarandon
 

Ähnlich wie PHP-MySQL Database Connectivity Using XAMPP Server (20)

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhost
 
PHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpPHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for php
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
WASPNEWServerDecoumentation
WASPNEWServerDecoumentationWASPNEWServerDecoumentation
WASPNEWServerDecoumentation
 
Web hosting Free Hosting
Web hosting Free HostingWeb hosting Free Hosting
Web hosting Free Hosting
 
Web hosting get start online
Web hosting get start onlineWeb hosting get start online
Web hosting get start online
 
Wamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationWamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and Configuration
 
Installation 02 (wp)
Installation 02 (wp)Installation 02 (wp)
Installation 02 (wp)
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
instaling
instalinginstaling
instaling
 
4th quarter 17 php & my sql registration page
4th quarter   17 php & my sql registration page4th quarter   17 php & my sql registration page
4th quarter 17 php & my sql registration page
 
How to Install a PHP Script in cPanel.pdf
How to Install a PHP Script in cPanel.pdfHow to Install a PHP Script in cPanel.pdf
How to Install a PHP Script in cPanel.pdf
 
How to Install Magento 2 On Wamp
How to Install Magento 2 On WampHow to Install Magento 2 On Wamp
How to Install Magento 2 On Wamp
 
Installation xampp and WordPress on localhost
Installation xampp and WordPress on localhostInstallation xampp and WordPress on localhost
Installation xampp and WordPress on localhost
 
How to install word press on local server
How to install word press on local serverHow to install word press on local server
How to install word press on local server
 
Install Word Press with xampp
Install Word Press with xamppInstall Word Press with xampp
Install Word Press with xampp
 
How to Install and Configure Drupal CMS
How to Install and Configure Drupal CMSHow to Install and Configure Drupal CMS
How to Install and Configure Drupal CMS
 

Kürzlich hochgeladen

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Kürzlich hochgeladen (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 

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).
  • 6.
  • 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.