php - Why is my delete operation not performing? -


in project, want delete operation particular id when click on delete button, isn't performing. here's code displaying table:

<table class="listing" cellpadding="0" cellspacing="0">       <tr>         <th class="first"><center>id</center></th>         <th>category name</th>         <th>status</th>         <th>edit</th>         <th class="last">delete</th>       </tr>   <?php    include('config.php');    $sql="select * category_tbl";    $result=mysql_query($sql);    while ($row=mysql_fetch_array($result)) { if($row['cat_status'] == 0) {   $im='<a href="category.php?false='.$row["cat_id"].'"><img src="../images/red.jpg" height="28" width="28"></a>';     }     else{         $im='<a href="category.php?true='.$row["cat_id"].'"><img src="../images/green.jpg" height="30" width="30"></a>';     }     if (isset($_request['false'])) {       $updt=mysql_query("update category_tbl set cat_status=1 cat_id='".$_request['false']."'");       header('location:category.php');     }     if (isset($_request['true'])) {       $updt=mysql_query("update category_tbl set cat_status=0 cat_id='".$_request['true']."'");       header('location:category.php');     }     ?>     <tr>         <td><strong><?php echo $row['cat_id'];?></strong></td>         <td><strong><?php echo $row['cat_name'];?></strong></td>         <td><?php echo $im;?></td>         <td><a href="update_cat.php?id=<?php echo $row['cat_id'];?>"><img src="../images/edit.jpg" height="30" width="60" value=<?php echo $row['cat_id'];?>></a></td>         <td><a href="delete_cat.php?id=<?php echo $row['cat_id'];?>"><img src="../images/delete1.jpg" height="30" width="60" value=<?php echo $row['cat_id'];?>></a></td>     </tr>     <?php   }   ?>   </table> 

the edit operation working, delete not. code delete:

<?php include("config.php"); $id=$_request['id']; $sql=mysql_query("delete category_tbl cat_id='".$id."'"); if ($sql) {     header("location:category.php"); }    ?> 

after execution stays on delete_cat.php?id=(passed id)....

i think need remove foreign key sub table or second option need alter query , set cascade this.

on delete cascade

for more visit link


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -