Advertisement
Bucurzoom

Untitled

Mar 23rd, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <?php
  2.  
  3. include_once '../dbconnect.php';
  4. include_once '../functions.php';
  5.  
  6.  
  7.  
  8. ini_set('display_errors', 1);
  9. ini_set('display_startup_errors', 1);
  10. error_reporting(E_ALL);
  11.  
  12.  
  13. /* Select queries return a resultset */
  14. if ($result = mysqli_query($con, "SELECT * FROM main_menu")) {
  15.  
  16. $select = ' "Select returned %d rows.\n", mysqli_num_rows($result));';
  17.  
  18. /* free result set */
  19. mysqli_free_result($result);
  20. }
  21.  
  22.  
  23. if(isset($_GET['delete_id'])) {
  24.  
  25. $result="DELETE FROM main_menu WHERE m_menu_id=".$_GET['delete_id'];
  26.  
  27. mysqli_query($con, $result) or die(mysqli_error());
  28.  
  29. header("Location: delete_menu.php");
  30. }
  31. ?>
  32. <!DOCTYPE html>
  33. <html>
  34. <head>
  35. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  36. <title>PHP Delete Data With Javascript Confirmation - By Cleartuts</title>
  37. <link rel="stylesheet" href="../css/admin.css" type="text/css" />
  38. <script type="text/javascript">
  39. function delete_id(id)
  40. {
  41. if(confirm('Sure To Remove This Record ?'))
  42. {
  43. window.location.href='delete_menu.php?delete_id='+id;
  44. }
  45. }
  46. </script>
  47. </head>
  48. <body>
  49. <center>
  50.  
  51. <div id="header">
  52. <div id="content">
  53.  
  54. </div>
  55. </div>
  56. <div id="body">
  57. <div id="content">
  58.  
  59.  
  60. <table class="table" align="center" border="1" cellspacing="1" cellpadding="2">
  61. <thead>
  62. <th>Id</th>
  63. <th>Title</th>
  64. <th>Action</th>
  65. </thead>
  66.  
  67. <?php
  68. $res=$con->query("SELECT * FROM main_menu");
  69. while($row=$res->fetch_array()) { ?>
  70.  
  71. <tr>
  72. <td><?php echo $row['m_menu_id']; ?></td>
  73. <td><?php echo $row['m_menu_name']; ?></td>
  74. <td align="center"><a href="javascript:delete_id(<?php echo $row['m_menu_id']; ?>)"><img src="delete.png" alt="Delete" /></a></td>
  75. </tr>
  76.  
  77. <?php
  78. }
  79. ?>
  80.  
  81. </table>
  82.  
  83.  
  84.  
  85. </div>
  86. </div>
  87.  
  88.  
  89.  
  90. </center>
  91. </body>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement