请对我温柔一点,我只是个新手。请告诉我这个功能不起作用的原因。没有错误,只是空白页。
<?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;
?>
它能工作吗?
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}' >";
}