【发布时间】:2016-10-17 21:29:04
【问题描述】:
如何回显这段代码的结果?
编辑:这是新代码。基于官方 PHP 网站的示例。
<?php
require 'connection.php';
$getid = $_GET["id"];
$sql = "SELECT * FROM pasteinfo WHERE id = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("i", $getid);
if ($stmt = $mysqli->prepare($sql)) {
$stmt->execute();
$stmt->bind_result($paste)
while($stmt->fetch()) {
printf ("%s \n", $paste);
}
$stmt->close();
$mysqli->close();
}
?>
【问题讨论】:
-
@MarcB 所以我的新代码有 while ($stmt->fetch()) { printf(%s); } 就在 $stmt->execute();但它使页面直接不可用?
-
或者您实际上可以阅读链接文档中的示例,因此您实际上可以正确使用它。另外,
printf(%s)是一个明显的语法错误。 -
@MarcB pastebin.com/C7ydHJuG 我的错!新代码在那里,有同样的问题。
-
将代码放在问题中,而不是远程链接。