好的,所以我已经在这几个小时了,无论我做什么,它都不起作用。我已经阅读了几页文档,甚至逐字逐句地尝试了示例,但仍然无法正常工作:
$db = mysqli_connect($db_server, $db_user, $db_passwd, $db_name);
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$db_query = "SELECT ca.id_article, ca.title, ca.body, ca.id_tag, ca.visible, ct.title AS tag_title
FROM cdfi_articles AS ca
INNER JOIN cdfi_tags AS ct ON(ct.id_tag = ca.id_tag)
WHERE ca.id_article = ?
LIMIT 1";
;
if ($stmt = mysqli_prepare($db, $db_query)) {
mysqli_stmt_bind_param($stmt, "i", $_REQUEST['article']);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $return);
mysqli_stmt_fetch($stmt);
var_dump($return);
}
mysqli_close($db);
发生以下错误,我完全不知道如何解决:
Warning: mysqli_stmt_bind_result() [function.mysqli-stmt-bind-result]: Number of bind variables doesn't match number of fields in prepared statement in ... filepath on line {line number}
bind variables
不匹配?我只使用 1 个变量,查询中只有 1 个问号,什么给出?
var_dump($return)
返回NULL
值
我怎样才能解决这个问题?我只想在$return
变量中返回那 1 行,以便我可以用它做点什么,arggg!