请温柔地对待我,我只是一个新手。请告诉我为什么这个功能不起作用的错误。没有错误,只有空白页。
<?php
include("db.php");
$id = (integer)$_GET['id'];
echo $id;
function updateshowdata($stmt, $con){
$stmt = $con->prepare("SELECT `firstname` FROM `MyGuests` where id =?");
$stmt->bind_param ('i',$id);
$stmt->execute ();
$stmt->bind_result ($firstname);
$updateshow = "<form method='post' action='updateprocess.php'>";
while ($stmt->fetch()) {
$updateshow .= "<input type='text' name='firstname' value='{$firstname}' >";
}
$updateshow .= "</form>";
echo $updateshow;
}
updateshowdata($stmt, $con);
?>
如果我将其更改为下面的删除功能,它将开始工作
<?php
include("db.php");
$id = (integer)$_GET['id'];
echo $id;
$stmt = $con->prepare("SELECT `firstname` FROM `MyGuests` where id =?");
$stmt->bind_param ('i',$id);
$stmt->execute ();
$stmt->bind_result ($firstname);
$updateshow = "<form method='post' action='updateprocess.php'>";
while ($stmt->fetch()) {
$updateshow .= "<input type='text' name='firstname' value='{$firstname}' >";
}
$updateshow .= "</form>";
echo $updateshow;
?>
答案 0 :(得分:1)
有效吗?
function updateshowdata($stmt, $con){
$id = (int)$GET['id'];
$stmt = $con->prepare("SELECT `firstname` FROM `MyGuests` where id =?");
$stmt->bind_param ('i',$id);
$stmt->execute ();
$stmt->bind_result ($firstname);
$updateshow = "<form method='post' action='updateprocess.php'>";
while ($stmt->fetch()) {
$updateshow .= "<input type='text' name='firstname' value='{$firstname}' >";
}