<pre><?php include 'conn.php'; $result = ("SELECT * FROM usrdata"); // selecting data through mysql_query() $count=mysqli_query($conn,$result); echo'<table border=1px>'; // opening table tag echo'<th>id</th><th>email</th><th>Password</th>'; //table headers while($data = mysqli_fetch_array($count)) { // we are running a while loop to print all the rows in a table echo'<tr>'; // printing table row echo '<td>'.$data['id'].'</td><td>'.$data['email'].'</td><td>'.$data['password'].'</td>'; // we are looping all data to be printed till last row in the table echo '<td><input type="button" name="delete" value="delete"></td>'; } echo'</tr>'; // closing table row echo '</table>'; if($_GET){ if(isset($_GET['delete'])){ delete(); }//elseif(isset($_GET['select'])){ //select(); //} } function delete() { $delete1 =("DELETE FROM `usrdata` WHERE id = '$id'"); $result = mysqli_query($conn,$delete1) or die(mysqli_error()); echo "record deleted"; } ?>
$delete1 =("DELETE FROM `usrdata` WHERE id = '$id'");
$id
value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)