SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
PHP Tutorials By Vineet Kumar Saini

                           Delete Statement in PHP

In this article I will explain how to delete data in the database through HTML table. In this
article you will see, data deleted from the front end i.e. HTML table.

Code

<?php
$con=mysql_connect ("localhost","root","");
mysql_select_db ("mcn",$con);
@$a=$_POST['txt1'];
@$b=$_POST['txt2'];
@$c=$_POST['txt3'];
@$d=$_POST['txt4'];
if(@$_POST ['del'])
{
 $s="delete from employee where name='$a'";
echo "Your Data Deleted";
 mysql_query ($s);
}
$con=mysql_connect ("localhost","root","");
mysql_select_db ("mcn",$con);
if(@$_POST ['sel'])
{
echo $ins=mysql_query ("select * from employee");
echo "<table bgcolor=skyblue border='2' align=center>
   <tr>
   <th colspan=4>Select Data From Employee Table</th></tr>
   <tr>
   <th>Nmae</th>
   <th>Designation</th>
   <th>Sal</th>
   <th>Qualification</th>
   </tr>";
   while ($row=mysql_fetch_array($ins))
   {
   echo "<tr>";
   echo "<th>".$row ['Name']."</th>";
   echo "<th>". $row ['Designation']. "</th>";
   echo "<th>". $row ['Sal']."</th>";
   echo "<th>".$row ['Qualification']."</th>";
   echo "</tr>";
   }
   }
  echo "</table>"
?>
<html>
<head>
</head>
<body bgcolor="pink">
< center>
PHP Tutorials By Vineet Kumar Saini

<table bgcolor="skyblue" border="2">
< form method="post">
< tr>
<td colspan=2 align="center">Employee Table</td>
</ tr>
<td>Name</td><td><input type="text" name="txt1"></td>
</ tr>
<tr>
<td>Designation</td><td><input type="text" name="txt2"></td>
</ tr>
<tr>
<td>Sal</td><td><input type="text" name="txt3"></td>
</ tr>
<tr>
<td>Qualification</td><td><input type="text" name="txt4"></td>
</ tr>
<tr>
<td><input type="submit" name="del" value="Delete"></td>
< td><input type="submit" name="sel" value="Select"></td>
</ tr>
</form>
</table>
</center>
</body>
</ html

Output

First of all you will select data from the database using the select button. When you will click
on the select button then you will see the data table displayed on your web page. Like as in
the following image.
PHP Tutorials By Vineet Kumar Saini

Suppose you want to delete Brajesh Kumar from your database. For this purpose you will fill
in the name of the employee in the employee table, then click on the delete button. You can
see in the following image.




When you will click on the delete button then display a message on your webpage i.e. "Your
Data Deleted".




Now you will click on the select button for the selected data from the database. When you
click on the select button then display data table on your web page. In this table you will
see Brajesh kumar employee not exist. You can see in the following image.
PHP Tutorials By Vineet Kumar Saini




Conclusion

So in this article you saw how to delete data from a database in a HTML table (front end).
Using this article one can easily understand how to delete data from a database.

Contenu connexe

Tendances

Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
ADARSH BHATT
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento Enterprise
Tobias Zander
 
Benchmarking Perl Lightning Talk (NPW 2007)
Benchmarking Perl Lightning Talk (NPW 2007)Benchmarking Perl Lightning Talk (NPW 2007)
Benchmarking Perl Lightning Talk (NPW 2007)
brian d foy
 
Form & frame
Form & frameForm & frame
Form & frame
aminsir
 

Tendances (20)

Couchdb
CouchdbCouchdb
Couchdb
 
Difference between mysql_fetch_array and mysql_fetch_assoc in PHP
Difference between mysql_fetch_array and mysql_fetch_assoc in PHPDifference between mysql_fetch_array and mysql_fetch_assoc in PHP
Difference between mysql_fetch_array and mysql_fetch_assoc in PHP
 
6. CodeIgniter copy2
6. CodeIgniter copy26. CodeIgniter copy2
6. CodeIgniter copy2
 
Php
PhpPhp
Php
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 
mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成
 
Mysql DBI
Mysql DBIMysql DBI
Mysql DBI
 
Java script form validation
Java script  form validationJava script  form validation
Java script form validation
 
Web.config
Web.configWeb.config
Web.config
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
Agile database access with CakePHP 3
Agile database access with CakePHP 3Agile database access with CakePHP 3
Agile database access with CakePHP 3
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento Enterprise
 
Benchmarking Perl Lightning Talk (NPW 2007)
Benchmarking Perl Lightning Talk (NPW 2007)Benchmarking Perl Lightning Talk (NPW 2007)
Benchmarking Perl Lightning Talk (NPW 2007)
 
17. delete data
17. delete data17. delete data
17. delete data
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
Web programming
Web programmingWeb programming
Web programming
 
Why study java script
Why study java scriptWhy study java script
Why study java script
 
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
 
Form & frame
Form & frameForm & frame
Form & frame
 
Msql
Msql Msql
Msql
 

Similaire à Delete statement in PHP

Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
Mouli Chandira
 
Web Application PHP and MySQL Database
Web Application PHP and MySQL DatabaseWeb Application PHP and MySQL Database
Web Application PHP and MySQL Database
Sunny U Okoro
 
12-security.ppt - PHP and Arabic Language - Index
12-security.ppt - PHP and Arabic Language - Index12-security.ppt - PHP and Arabic Language - Index
12-security.ppt - PHP and Arabic Language - Index
webhostingguy
 
Php code for online quiz
Php code for online quizPhp code for online quiz
Php code for online quiz
hnyb1002
 
Creating simple php contact form
Creating simple php contact formCreating simple php contact form
Creating simple php contact form
Daniel Downs
 
Caracteristicas Basicas De Htlm
Caracteristicas Basicas De HtlmCaracteristicas Basicas De Htlm
Caracteristicas Basicas De Htlm
Maria S Rivera
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
 

Similaire à Delete statement in PHP (20)

Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
 
Lab final
Lab finalLab final
Lab final
 
Web Application PHP and MySQL Database
Web Application PHP and MySQL DatabaseWeb Application PHP and MySQL Database
Web Application PHP and MySQL Database
 
12-security.ppt - PHP and Arabic Language - Index
12-security.ppt - PHP and Arabic Language - Index12-security.ppt - PHP and Arabic Language - Index
12-security.ppt - PHP and Arabic Language - Index
 
Security.ppt
Security.pptSecurity.ppt
Security.ppt
 
Php code for online quiz
Php code for online quizPhp code for online quiz
Php code for online quiz
 
Creating simple php contact form
Creating simple php contact formCreating simple php contact form
Creating simple php contact form
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”
 
SQL -PHP Tutorial
SQL -PHP TutorialSQL -PHP Tutorial
SQL -PHP Tutorial
 
Caracteristicas Basicas De Htlm
Caracteristicas Basicas De HtlmCaracteristicas Basicas De Htlm
Caracteristicas Basicas De Htlm
 
Theme
ThemeTheme
Theme
 
Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.
 
Lect# 1 html part ii
Lect# 1 html part iiLect# 1 html part ii
Lect# 1 html part ii
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
Php (1)
Php (1)Php (1)
Php (1)
 
ADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael PizzoADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
 
1cst
1cst1cst
1cst
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
PureScript & Pux
PureScript & PuxPureScript & Pux
PureScript & Pux
 

Plus de Vineet Kumar Saini

Plus de Vineet Kumar Saini (20)

Abstract Class and Interface in PHP
Abstract Class and Interface in PHPAbstract Class and Interface in PHP
Abstract Class and Interface in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Stripe in php
Stripe in phpStripe in php
Stripe in php
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Install Drupal on Wamp Server
Install Drupal on Wamp ServerInstall Drupal on Wamp Server
Install Drupal on Wamp Server
 
Joomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDFJoomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDF
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
Sorting arrays in PHP
Sorting arrays in PHPSorting arrays in PHP
Sorting arrays in PHP
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
 
Implode & Explode in PHP
Implode & Explode in PHPImplode & Explode in PHP
Implode & Explode in PHP
 
Types of Error in PHP
Types of Error in PHPTypes of Error in PHP
Types of Error in PHP
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Browser information in PHP
Browser information in PHPBrowser information in PHP
Browser information in PHP
 
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Delete statement in PHP

  • 1. PHP Tutorials By Vineet Kumar Saini Delete Statement in PHP In this article I will explain how to delete data in the database through HTML table. In this article you will see, data deleted from the front end i.e. HTML table. Code <?php $con=mysql_connect ("localhost","root",""); mysql_select_db ("mcn",$con); @$a=$_POST['txt1']; @$b=$_POST['txt2']; @$c=$_POST['txt3']; @$d=$_POST['txt4']; if(@$_POST ['del']) { $s="delete from employee where name='$a'"; echo "Your Data Deleted"; mysql_query ($s); } $con=mysql_connect ("localhost","root",""); mysql_select_db ("mcn",$con); if(@$_POST ['sel']) { echo $ins=mysql_query ("select * from employee"); echo "<table bgcolor=skyblue border='2' align=center> <tr> <th colspan=4>Select Data From Employee Table</th></tr> <tr> <th>Nmae</th> <th>Designation</th> <th>Sal</th> <th>Qualification</th> </tr>"; while ($row=mysql_fetch_array($ins)) { echo "<tr>"; echo "<th>".$row ['Name']."</th>"; echo "<th>". $row ['Designation']. "</th>"; echo "<th>". $row ['Sal']."</th>"; echo "<th>".$row ['Qualification']."</th>"; echo "</tr>"; } } echo "</table>" ?> <html> <head> </head> <body bgcolor="pink"> < center>
  • 2. PHP Tutorials By Vineet Kumar Saini <table bgcolor="skyblue" border="2"> < form method="post"> < tr> <td colspan=2 align="center">Employee Table</td> </ tr> <td>Name</td><td><input type="text" name="txt1"></td> </ tr> <tr> <td>Designation</td><td><input type="text" name="txt2"></td> </ tr> <tr> <td>Sal</td><td><input type="text" name="txt3"></td> </ tr> <tr> <td>Qualification</td><td><input type="text" name="txt4"></td> </ tr> <tr> <td><input type="submit" name="del" value="Delete"></td> < td><input type="submit" name="sel" value="Select"></td> </ tr> </form> </table> </center> </body> </ html Output First of all you will select data from the database using the select button. When you will click on the select button then you will see the data table displayed on your web page. Like as in the following image.
  • 3. PHP Tutorials By Vineet Kumar Saini Suppose you want to delete Brajesh Kumar from your database. For this purpose you will fill in the name of the employee in the employee table, then click on the delete button. You can see in the following image. When you will click on the delete button then display a message on your webpage i.e. "Your Data Deleted". Now you will click on the select button for the selected data from the database. When you click on the select button then display data table on your web page. In this table you will see Brajesh kumar employee not exist. You can see in the following image.
  • 4. PHP Tutorials By Vineet Kumar Saini Conclusion So in this article you saw how to delete data from a database in a HTML table (front end). Using this article one can easily understand how to delete data from a database.