Ok here is the php code for deletion
<?php
require '../../AppData/database.php'; $id = 0;
if ( !empty($_GET['ActNo'])) {
$id = $_REQUEST['ActNo'];
}
$sec = 0;
if ( !empty($_GET['SectionNo'])) {
$sec = $_REQUEST['SectionNo'];
}
if ( !empty($_POST)) {
// keep track post values
$id = $_POST['ActNo'];
$sec = $_POST['SectionNo'];
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "DELETE FROM section WHERE ActNo = ? AND SectionNo = ?";
$q = $pdo->prepare($sql);
$q->execute(array($id, $sec));
Database::disconnect();
header("Location: index.php");
}
?>
The problem: It doesn't work. either mysql statement is incorrect or their might be problem with pdo stuff . It could also be something about $_POST and GET and REQUEST things. I tried to change the sql statement then it will delete the whole table. changing the variables doesn't work either.
I want it to delete only one record at a time. Please someone give me some suggestion.