anantamu.com


PHP MySQL DETELE statement


The DETELE statement is used to delete data from table


DETELE STATEMENT

DETELE FROM tableName WHERE columnName=value

Displaying the records and action of delete from Profile table.

<?php
$servername = "localhost";
$username1 = "root";
$password1 = "";
$dbname = "sample";
//server connection
$connection = mysqli_connect($servername, $username1, $password1, $dbname);
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}
$sqlQuery='select * from profile';


$resultSql=mysqli_query($conn, $sqlQuery);
echo '<table>'
echo '<tr><td>Name</td><td>phonenumber</td><td>Action</td></tr>';

if (@mysqli_num_rows(@$resultSql) >= 1) {
// output data of each row
  while ($rowValue = mysqli_fetch_assoc($resultSql)) {
	  echo '<tr>';
	  echo '<td>'.$rowValue['name'].'</td>;
	  echo  '<td>'.$rowValue['phonenumber'].'</td>';
	  echo  '<td>'."<a href="profileDelete.php?id=".$rowValue['id'].">Delete</a>".'</td>';
	  echo '</tr>';

  }
}else{	
	echo '<tr><td>no records found</td><td></td></tr>';
}
echo '</table>'
mysqli_close($conn);
?> 
                    

When user click the delete then it goes to this page profileDelete.php and action will perform.


Detele the profile details: profileDelete.php file

<?php
$servername = "localhost";
$username1 = "root";
$password1 = "";
$dbname = "sample";
//server connection
$connection = mysqli_connect($servername, $username1, $password1, $dbname);
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}
$sqlQuery="delete from  profile  WHERE id = '" . $_GET['id'] . "' ";


$resultSql=mysqli_query($conn, $sqlQuery);

mysqli_close($conn);
?> 
                    


List of All 223 Banks



Bank IFSC CODE