SlideShare a Scribd company logo
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "DB";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$first_name=$_POST['firstname'];
$last_name=$_POST['lastname'];
$sql = "INSERT INTO DB (firstname, lastname, email)
VALUES ('John', 'Doe', 'john@example.com')";
Update Query:
<?php
if ($_POST['update'])
{
$id=$_POST['id'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$address=$_POST['address'];
$city=$_POST[‘id’];
$phone=$_POST['phone'];
$password=$_POST['password'];
$sql = "UPDATE FF SET lastname='Doe' WHERE id=2";
Del Query:
<a href="open_delete.php?del=<?php echo $row['id']; ?>">Delete</a>
<?php } ?>
$sql = "DELETE FROMDB WHERE id=1";
View Query:
<table class="table table-striped " width="60%" align="center">
<thead>
<tr>
<th align="center">ID</th>
<th align="center">First Name</th>
<th align="center">Last Name</th>
<th align="center">Email</th>
<th align="center">Address</th>
<th align="center">City</th>
<th align="center">Postal Code</th>
<th align="center">Phone Number</th>
<th align="center">Mobiel</th>
<th align="center">Password</th>
<th align="center">Action</th>
<?php
include("../connection.php");
$select="SELECT * FROM `openliveaccount`";
$query=mysqli_query($conn,$select);
while($row=mysqli_fetch_array($query))
{
$id=$row['id'];
?>
</tr>
</thead>
<tbody>
<tr>
<td ><?php echo $row['id'];?></td>
<td ><?php echo $row['first_name'];?></td>
<td ><?php echo $row['last_name'];?></td>
<td ><?php echo $row['email'];?></td>
<td ><?php echo $row['address'];?></td>
<td ><?php echo $row['city'];?></td>
<td ><?php echo $row['postal_code'];?></td>
<td ><?php echo $row['phone_number'];?></td>
<td ><?php echo $row['mobile'];?></td>
<td ><?php echo $row['password'];?></td>

More Related Content

Similar to Php.docx

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 PHPVineet Kumar Saini
 
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 languageLovely Professional University
 
Database Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and MysqlDatabase Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and MysqlAl-Mamun Sarkar
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
Practical MySQL.pptx
Practical MySQL.pptxPractical MySQL.pptx
Practical MySQL.pptxHussainUsman4
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 
Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)Dan Michael Molina
 
Unit 4- Working with SQL.pptx
Unit 4- Working with SQL.pptxUnit 4- Working with SQL.pptx
Unit 4- Working with SQL.pptxmythili213835
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performanceLeon Fayer
 
Connecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptxConnecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptxTempMail233488
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data ObjectsWez Furlong
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 

Similar to Php.docx (20)

Php
PhpPhp
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
 
Php
PhpPhp
Php
 
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
 
Php 101: PDO
Php 101: PDOPhp 101: PDO
Php 101: PDO
 
Daily notes
Daily notesDaily notes
Daily notes
 
Database Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and MysqlDatabase Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and Mysql
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Practical MySQL.pptx
Practical MySQL.pptxPractical MySQL.pptx
Practical MySQL.pptx
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)Eden Hackathon Benilde (Mysql & SMTP)
Eden Hackathon Benilde (Mysql & SMTP)
 
Unit 4- Working with SQL.pptx
Unit 4- Working with SQL.pptxUnit 4- Working with SQL.pptx
Unit 4- Working with SQL.pptx
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performance
 
Connecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptxConnecting_to_Database(MySQL)_in_PHP.pptx
Connecting_to_Database(MySQL)_in_PHP.pptx
 
Mysql & Php
Mysql & PhpMysql & Php
Mysql & Php
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data Objects
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 

Recently uploaded

Expert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting ServicesExpert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting ServicesResDraft
 
CA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdfCA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdfSudhanshuMandlik
 
Transforming Brand Perception and Boosting Profitability
Transforming Brand Perception and Boosting ProfitabilityTransforming Brand Perception and Boosting Profitability
Transforming Brand Perception and Boosting Profitabilityaaryangarg12
 
Top 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen DesignsTop 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen DesignsFinzo Kitchens
 
The Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptxThe Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptxadityakushalsaha
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designboryssutkowski
 
Common Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid themCommon Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid themmadhavlakhanpal29
 
Book Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for DesignersBook Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for DesignersConfidence Ago
 
National-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptxNational-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptxAlecAnidul
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdffabianavillanib
 
Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.rrimika1
 
Top Israeli Products and Brands - Plan it israel.pdf
Top Israeli Products and Brands - Plan it israel.pdfTop Israeli Products and Brands - Plan it israel.pdf
Top Israeli Products and Brands - Plan it israel.pdfPlanitIsrael
 
The Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to FashionThe Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to FashionPixel poets
 

Recently uploaded (13)

Expert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting ServicesExpert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting Services
 
CA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdfCA OFFICE office office office _VIEWS.pdf
CA OFFICE office office office _VIEWS.pdf
 
Transforming Brand Perception and Boosting Profitability
Transforming Brand Perception and Boosting ProfitabilityTransforming Brand Perception and Boosting Profitability
Transforming Brand Perception and Boosting Profitability
 
Top 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen DesignsTop 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen Designs
 
The Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptxThe Design Code Google Developer Student Club.pptx
The Design Code Google Developer Student Club.pptx
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior design
 
Common Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid themCommon Designing Mistakes and How to avoid them
Common Designing Mistakes and How to avoid them
 
Book Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for DesignersBook Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for Designers
 
National-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptxNational-Learning-Camp 2024 deped....pptx
National-Learning-Camp 2024 deped....pptx
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
 
Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.Art Nouveau Movement Presentation for Art History.
Art Nouveau Movement Presentation for Art History.
 
Top Israeli Products and Brands - Plan it israel.pdf
Top Israeli Products and Brands - Plan it israel.pdfTop Israeli Products and Brands - Plan it israel.pdf
Top Israeli Products and Brands - Plan it israel.pdf
 
The Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to FashionThe Evolution of Fashion Trends: History to Fashion
The Evolution of Fashion Trends: History to Fashion
 

Php.docx

  • 1. <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "DB"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $first_name=$_POST['firstname']; $last_name=$_POST['lastname']; $sql = "INSERT INTO DB (firstname, lastname, email) VALUES ('John', 'Doe', 'john@example.com')"; Update Query: <?php if ($_POST['update']) { $id=$_POST['id']; $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST[‘id’]; $phone=$_POST['phone']; $password=$_POST['password']; $sql = "UPDATE FF SET lastname='Doe' WHERE id=2";
  • 2. Del Query: <a href="open_delete.php?del=<?php echo $row['id']; ?>">Delete</a> <?php } ?> $sql = "DELETE FROMDB WHERE id=1"; View Query: <table class="table table-striped " width="60%" align="center"> <thead> <tr> <th align="center">ID</th> <th align="center">First Name</th> <th align="center">Last Name</th> <th align="center">Email</th> <th align="center">Address</th> <th align="center">City</th> <th align="center">Postal Code</th> <th align="center">Phone Number</th> <th align="center">Mobiel</th> <th align="center">Password</th> <th align="center">Action</th> <?php include("../connection.php"); $select="SELECT * FROM `openliveaccount`"; $query=mysqli_query($conn,$select); while($row=mysqli_fetch_array($query)) { $id=$row['id']; ?> </tr> </thead> <tbody> <tr> <td ><?php echo $row['id'];?></td> <td ><?php echo $row['first_name'];?></td> <td ><?php echo $row['last_name'];?></td> <td ><?php echo $row['email'];?></td> <td ><?php echo $row['address'];?></td> <td ><?php echo $row['city'];?></td> <td ><?php echo $row['postal_code'];?></td>
  • 3. <td ><?php echo $row['phone_number'];?></td> <td ><?php echo $row['mobile'];?></td> <td ><?php echo $row['password'];?></td>