I am using a mysqli prepard query with php, the code is:
$retreiveQuery = 'SELECT username, firstname, lastname FROM USERS WHERE username = ?';
if ($getRecords = $con->prepare($retreiveQuery)) {
$getRecords->bind_param("s", $username);
$getRecords->execute();
$getRecords->bind_result($username, $firstname, $lastname);
echo "<h1>".$username."</h1>
<p><strong>First Name: </strong>".$firstname."
<p><strong>Surname: </strong>".$lastname."
} else {
print_r($con->error);
This is quite strange. username is the only field which is displayed. Why would the other columns not be being returned/bound?
If I do
SELECT username, firstname, lastname FROM USERS WHERE username = 'test';
Directly to the database, all fields are displayed, and all contain valid data.