简体   繁体   English

mysqli准备语句失败

[英]mysqli prepared statement fails


I'm using a prepared statement that fails and I don't know why (no error is returned) 我使用的是失败的准备好的语句,我不知道为什么(不返回错误)
Here's my code: 这是我的代码:

$stmt = $db->prepare("SELECT id, temps, nom, classes FROM profs WHERE matiere = ? AND pass = 0");
if ( false===$stmt ) {
    die('prepare() failed: ('.$db->errno.')' . htmlspecialchars($db->error));
}
$rc = $stmt->bind_param("s", $mat);
if ( false===$rc ) {
    die('bind_param() failed: ('.$db->errno.')' . htmlspecialchars($stmt->error));
}
$rc = $stmt->execute();
if ( false===$rc ) {
    die('execute() failed: ('.$db->errno.')' . htmlspecialchars($stmt->error));
}

This returns only: "prepare() failed: (0)" 这仅返回:“ prepare()失败:(0)”
Where's the problem? 哪里出问题了?

SELECT id, temps, nom, classes FROM profs WHERE matiere = ? AND pass = 0

Is this query valid? 此查询有效吗? Does the profs table exist, and do the columns (id, temps, nom, classes, matiere, pass) exist (and spelt correctly!) profs表是否存在,并且列(id,temps,nom,class,matiere,pass)是否存在(并且拼写正确!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM