Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 准备好的语句打印不正确_Php_Mysql_Mysqli - Fatal编程技术网

Php 准备好的语句打印不正确

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($

我已经做了一个准备好的声明,但是我一直在打印我的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($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子句中