SlideShare a Scribd company logo
PHP WITH MYSQL
USING FORMS
Database creation
<?php
$con=new mysqli("localhost","root","");
if($con->connect_error)
echo "failed";
else
echo "Connected";
$sql="CREATE DATABASE trgj";
if($con->query($sql)===TRUE)
echo "success";
else
echo "table failed";
?>
Table creation
<?php
$con=new mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$sql="CREATE TABLE trgjtable(name varchar(10) not null)";
if($con->query($sql)===TRUE)
echo "success";
else
echo "table failed";
?>
Insertion
<?php
$con=new mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$sql="INSERT INTO trgjtable values('mani')";
if($con->query($sql)===TRUE)
echo "success";
else
echo "table failed";
?>
Selection
<?php
$con=new mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$sql="SELECT * FROM trgjtable";
$res=$con->query($sql);
if($res->num_rows>0)
{
while($row=$res->fetch_assoc())
{
echo "name:".$row["name"];
}}
?>
Updation
<?php
$con=new mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$up="UPDATE trgjtable set name='gomathi' where name='mani'";
if($con->query($up)===TRUE){
echo "updated";
}else{
echo "not updated";
}
$sql="SELECT * FROM trgjtable";
$res=$con->query($sql);
if($res->num_rows>0)
{
while($row=$res->fetch_assoc())
{
echo "name:".$row["name"];
}}
?>
Deletion
<?php
$con=new
mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$up="delete from trgjtable where
name='gomathi'";
if($con->query($up)===TRUE)
{
echo "deleted";
}else{
echo "not deleted";
}
PHP with MySQL using Form
Forms.html
<html >
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="result.php", method="post">
Name: <input type="text" name="username" /> <br />
Email: <input type="text" name="email" /> <br />
<input type="submit" value="insert" />
</form>
</body>
</html>
Result.php
<?php
$con=new mysqli("localhost","root","",'trgj');
if($con->connect_error)
echo "failed";
else
echo "Connected";
$sql= "create table person(username varchar(10), email varchar(15))";
if($con->query($sql)===true)
echo "Table Created";
$name=$_POST['username'];
$email=$_POST['email'];
$in="insert into person(username,email) values('$name','$email')";
if($con->query($in)===TRUE)
{
echo "successfully inserted";
}
else{
echo "Not Inserted";
}
header("refresh:2; url=forms.html");
?>
THANK YOU
Ad

Recommended

TICT #11
TICT #11
azman_awan9
 
TICT #13
TICT #13
azman_awan9
 
Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQL
Nur Fadli Utomo
 
Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
Nur Fadli Utomo
 
LAMP_TRAINING_SESSION_8
LAMP_TRAINING_SESSION_8
umapst
 
hotel managment
hotel managment
Melk Biks
 
Karan chanana
Karan chanana
karan chanana
 
Php
Php
anilcoolz881234
 
Security and Mobility - WordCamp Porto 2016
Security and Mobility - WordCamp Porto 2016
Marcel Schmitz
 
Borrados
Borrados
orlanodavidescobar
 
Practica csv
Practica csv
Nones Pomposo
 
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
mauricemuteti2015
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
Dennis Knochenwefel
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Pagination in PHP
Pagination in PHP
Vineet Kumar Saini
 
Coding website
Coding website
PutuMahendra Wijaya
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
Vineet Kumar Saini
 
Php
Php
Linh Tran
 
Country State City Dropdown in PHP
Country State City Dropdown in PHP
Vineet Kumar Saini
 
4. Php MongoDB view_data
4. Php MongoDB view_data
Razvan Raducanu, PhD
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Jqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
Mozammel Haque
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
Ralph Winzinger
 
PhoneGap: Local Storage
PhoneGap: Local Storage
Ivano Malavolta
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordCamp Kyiv
 
次世代版 PowerCMS 開発プロジェクトのご紹介
次世代版 PowerCMS 開発プロジェクトのご紹介
純生 野田
 
PowerCMS X
PowerCMS X
純生 野田
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
Arti Parab Academics
 
Basics of Working with PHP and MySQL.pptx
Basics of Working with PHP and MySQL.pptx
jensas21
 

More Related Content

What's hot (20)

Security and Mobility - WordCamp Porto 2016
Security and Mobility - WordCamp Porto 2016
Marcel Schmitz
 
Borrados
Borrados
orlanodavidescobar
 
Practica csv
Practica csv
Nones Pomposo
 
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
mauricemuteti2015
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
Dennis Knochenwefel
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Pagination in PHP
Pagination in PHP
Vineet Kumar Saini
 
Coding website
Coding website
PutuMahendra Wijaya
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
Vineet Kumar Saini
 
Php
Php
Linh Tran
 
Country State City Dropdown in PHP
Country State City Dropdown in PHP
Vineet Kumar Saini
 
4. Php MongoDB view_data
4. Php MongoDB view_data
Razvan Raducanu, PhD
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Jqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
Mozammel Haque
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
Ralph Winzinger
 
PhoneGap: Local Storage
PhoneGap: Local Storage
Ivano Malavolta
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordCamp Kyiv
 
次世代版 PowerCMS 開発プロジェクトのご紹介
次世代版 PowerCMS 開発プロジェクトのご紹介
純生 野田
 
PowerCMS X
PowerCMS X
純生 野田
 
Security and Mobility - WordCamp Porto 2016
Security and Mobility - WordCamp Porto 2016
Marcel Schmitz
 
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
HOW TO UPLOAD AND DISPLAY IMAGE PHP HTML SQL
mauricemuteti2015
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
Dennis Knochenwefel
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
Vineet Kumar Saini
 
Country State City Dropdown in PHP
Country State City Dropdown in PHP
Vineet Kumar Saini
 
PHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Jqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
Mozammel Haque
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
Ralph Winzinger
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordCamp Kyiv
 
次世代版 PowerCMS 開発プロジェクトのご紹介
次世代版 PowerCMS 開発プロジェクトのご紹介
純生 野田
 

Similar to Coding for php with mysql (20)

FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
Arti Parab Academics
 
Basics of Working with PHP and MySQL.pptx
Basics of Working with PHP and MySQL.pptx
jensas21
 
Connecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptx
TempMail233488
 
4.3 MySQL + PHP
4.3 MySQL + PHP
Jalpesh Vasa
 
Mysql & Php
Mysql & Php
Inbal Geffen
 
PHP DATABASE MANAGEMENT.pptx
PHP DATABASE MANAGEMENT.pptx
CynthiaKendi1
 
chapter_Seven Database manipulation using php.pptx
chapter_Seven Database manipulation using php.pptx
Getawu
 
Php 101: PDO
Php 101: PDO
Jeremy Kendall
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
SULTHAN BASHA
 
Php talk
Php talk
Jamil Ramsey
 
More Php
More Php
Digital Insights - Digital Marketing Agency
 
DBD::SQLite
DBD::SQLite
charsbar
 
Practical MySQL.pptx
Practical MySQL.pptx
HussainUsman4
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
Mohd Harris Ahmad Jaal
 
Database presentation
Database presentation
webhostingguy
 
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
berihun18
 
Php mysq
Php mysq
prasanna pabba
 
UNIT V (5).pptx
UNIT V (5).pptx
DrDhivyaaCRAssistant
 
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
DIWE - Working with MySQL Databases
DIWE - Working with MySQL Databases
Rasan Samarasinghe
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
Arti Parab Academics
 
Basics of Working with PHP and MySQL.pptx
Basics of Working with PHP and MySQL.pptx
jensas21
 
Connecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptx
TempMail233488
 
PHP DATABASE MANAGEMENT.pptx
PHP DATABASE MANAGEMENT.pptx
CynthiaKendi1
 
chapter_Seven Database manipulation using php.pptx
chapter_Seven Database manipulation using php.pptx
Getawu
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
SULTHAN BASHA
 
DBD::SQLite
DBD::SQLite
charsbar
 
Practical MySQL.pptx
Practical MySQL.pptx
HussainUsman4
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
Mohd Harris Ahmad Jaal
 
Database presentation
Database presentation
webhostingguy
 
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
berihun18
 
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
DIWE - Working with MySQL Databases
DIWE - Working with MySQL Databases
Rasan Samarasinghe
 
Ad

More from Rajamanickam Gomathijayam (9)

Computer Application in Business
Computer Application in Business
Rajamanickam Gomathijayam
 
Sololearn cert
Sololearn cert
Rajamanickam Gomathijayam
 
Uml ppt
Uml ppt
Rajamanickam Gomathijayam
 
Php with mysql ppt
Php with mysql ppt
Rajamanickam Gomathijayam
 
Corel Draw Introduction
Corel Draw Introduction
Rajamanickam Gomathijayam
 
Introduction to computer graphics
Introduction to computer graphics
Rajamanickam Gomathijayam
 
Introducction to Algorithm
Introducction to Algorithm
Rajamanickam Gomathijayam
 
Artificial Intelligence
Artificial Intelligence
Rajamanickam Gomathijayam
 
Network Concepts
Network Concepts
Rajamanickam Gomathijayam
 
Ad

Recently uploaded (20)

LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
“THE BEST CLASS IN SCHOOL”. _
“THE BEST CLASS IN SCHOOL”. _
Colégio Santa Teresinha
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
LDMMIA Practitioner Student Reiki Yoga S2 Video PDF Without Yogi Goddess
LDMMIA Practitioner Student Reiki Yoga S2 Video PDF Without Yogi Goddess
LDM & Mia eStudios
 
LDMMIA Yoga S10 Free Workshop Grad Level
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
LDMMIA Practitioner Student Reiki Yoga S2 Video PDF Without Yogi Goddess
LDMMIA Practitioner Student Reiki Yoga S2 Video PDF Without Yogi Goddess
LDM & Mia eStudios
 
LDMMIA Yoga S10 Free Workshop Grad Level
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 

Coding for php with mysql