public function delete($id = null) { if (is_null($id)) { Utility::message("<div class=\"message_error\">No id avaiable. Sorry !</div>"); Utility::redirect('index.php'); } $conn = mysql_connect("localhost", "root", "") or die("Cannot connect database."); $lnk = mysql_select_db("atomicproject") or die("Cannot select database."); $query = "DELETE FROM `atomicproject`.`summary` WHERE `summary`.`id` = " . $id; $result = mysql_query($query); if ($result) { Utility::message("<div class=\"message_success\">Summary is deleted successfully.</div>"); } else { Utility::message("<div class=\"message_error\">Cannot delete.</div>"); } Utility::redirect('index.php'); }
<!-- Bootstrap --> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <link href="../../css/style.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <h1 class="text-center">Summary</h1> <div class="wrapper"> <?php echo Utility::message(); ?> <div class="actionDiv"><span>Search / Filter </span> <span id="utility">Download as PDF | XL <a href="create.php">Add New</a></span> <select> <option>10</option> <option>20</option> <option>30</option> <option>40</option> <option>50</option> </select> </div> <table class="table table-bordered"> <thead> <tr> <th>SL</th>