我想将查询结果中的数据输出到文本输入和普通回声中,但它不输出任何内容。我在php中没有错误,我在mysqli代码中做错了什么,它没有回应任何东西?
function ShowAssessment()
{
$sessiondetailsquery = "
SELECT SessionId, SessionName
FROM Session
WHERE
(SessionId = ?)";
global $mysqli;
$sqlstmt=$mysqli->prepare($sessiondetailsquery);
$sqlstmt->bind_param("i",$_POST["session"]);
$sessiondetailsqrystmt=$mysqli->prepare($sessiondetailsquery);
// You only need to call bind_param once
$sessiondetailsqrystmt->bind_param("i",$_POST["session"]);
// get result and assign variables (prefix with db)
$sessiondetailsqrystmt->execute();
$sessiondetailsqrystmt->bind_result($detailsSessionId,$detailsSessionName);?>
$sqlstmt->fetch();
$sqlstmt->close();
<h3>CHOSEN ASSESSMENT</h3>
<input type='text' id='currentId' name='Idcurrent' readonly='readonly' value='<?php $detailsSessionId; ?>' /></td>
<br>
<strong>Assessment:</strong> <?php echo $detailsSessionName; ?>
<?php
}
?>
答案 0 :(得分:1)
你的代码中有2个bind_params做同样的事情。