本文介绍了致命错误:消息为"SQLSTATE [42S22]"的未捕获异常"PDOException":找不到列:1054"where子句"中的未知列"id"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?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");
}
?>
有人可以帮助我吗?为什么我得到消息为"SQLSTATE [42S22]"的未捕获异常"PDOException"
somebody can help me? why i gotUncaught exception 'PDOException' with message 'SQLSTATE[42S22]
对不起,我的英语不好谢谢
sorry my english is bad,thanks
推荐答案
错误消息表明数据库中的表admin
没有名为id
的列.您需要检查表中可用的列,但是如果没有更多信息(例如表定义),我将无济于事.
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.
这篇关于致命错误:消息为"SQLSTATE [42S22]"的未捕获异常"PDOException":找不到列:1054"where子句"中的未知列"id"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!