Php 准备好的语句打印不正确
我已经做了一个准备好的声明,但是我一直在打印我的else声明,在本例中是0结果。我的代码中没有任何错误。这里有我遗漏的东西吗Php 准备好的语句打印不正确,php,mysql,mysqli,Php,Mysql,Mysqli,我已经做了一个准备好的声明,但是我一直在打印我的else声明,在本例中是0结果。我的代码中没有任何错误。这里有我遗漏的东西吗 <?php include 'dbconnection.php'; error_reporting(E_ALL); ini_set('display_errors', 1); if (mysqli_connect_errno()) { echo "Error: no connexion allowed : " . mysqli_connect_error($
<?php
include 'dbconnection.php';
error_reporting(E_ALL); ini_set('display_errors', 1);
if (mysqli_connect_errno()) { echo "Error: no connexion allowed : " . mysqli_connect_error($mysqli); }
if(isset($_POST["headline"], $_POST["description"])) {
$head = trim($_POST["headline"]);
$desc = trim($_POST["description"]);
}
$query = ("SELECT headline, description FROM articles WHERE headline=? AND description=?");
$stmt = $mysqli->prepare($query);
$stmt->bind_param("ss", $head, $describe);
$stmt->execute();
$stmt->bind_result($head, $describe);
$stmt->store_result();
if ($stmt->num_rows > 0) {
while($stmt->fetch()){
echo"[ $head -> $describe ]<br />";
}
}
else
{ echo"[ 0 results ]"; }
$stmt->close();
?>
$head,$descripe
在哪里定义?连接在哪里?使用错误报告某些内容未连接或您的查询失败。“这里缺少什么内容吗?”-连接和变量分配从数据库中选择与您假定已经拥有的完全相同的值有什么意义?看起来您处于(false)下给人的印象是,出于某种原因选定的字段应该列在WHERE子句中