<?php
require 'database.php';
$id = 0;
if ( !empty($_GET['user_id'])) {
$id = $_REQUEST['user_id'];
}
if ( !empty($_POST)) {
// keep track post values
$id = $_POST['user_id'];
// delete data
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "DELETE FROM admin WHERE id = ?"; ===> Wrong on here.. //LINE18
$q = $pdo->prepare($sql);
$q->execute(array($id));
Database::disconnect();
header("Location: index.php");
}
?>
somebody can help me? why i got Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]
sorry my english is bad, thanks
The error message indicates that the table admin
in your database does not have a column called id
. You need to check what columns are available in the table, but without more information (such as the table definition), I can't be more help.