gpt4 book ai didi

php - 字段列表中的未知列

转载 作者:行者123 更新时间:2023-11-30 23:25:23 25 4
gpt4 key购买 nike

我一直收到错误 Unknown Column in field List

数据库有这些字段:

ID - AUTO INCRIMENT
username
password
groupID
prefs_list_item

这是我的代码。变量作为一个设置值存储在上面,我知道这不会给我任何问题,因为我在同一脚本中的其他数据库中使用它们。

try {
$wpdb = new PDO('mysql:host=localhost; dbname=******', '*******',
'*******');
$wpdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

//Creates the SQL statement to write into the picture database
$pictureUPDATE = $wpdb->prepare
("INSERT INTO pe_users (
username,
password,
groupID
) VALUES (
$username,
$passmd5,
$groupID
)
");
//Executes the writing into the picture database
$pictureUPDATE->execute();
echo("<p>Your account to upload photos is now active!</p>");
}
//catches any errors that might have come from updating the picture databse
catch (PDOException $ex) {
$msg = $ex->errorInfo;
error_log(var_export($msg, true));
die("<p>Sorry, there was a unrecoverable database error with PICTURES.
Debug data has been logged.</p>");
}

不知道发生了什么,有人知道吗?

最佳答案

尝试做:

$data = array( 'username' => $username, 'password' => $passmd5, 'groupID' => $groupID );

$pictureUPDATE = $wpdb->("INSERT INTO pe_users
(username, password, groupID) value (:username, :password, :groupID)");

$pictureUPDATE->execute($data);

关于php - 字段列表中的未知列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13617350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com