I want to output data from a query result into a text input and a normal echo but it is not outputting anything. I have no errors in php, am I doing something wrong in mysqli code that it is not echoing anything?
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
}
?>
You’ve got 2 bind_params doing the same thing in your code.