I see where I am getting a row of data as a result of executing the stmt (expected).
However, when using the get_result()
method to return a mysqli::result
, there are no fields in the result instance, (not expected, there should be 5 fields).
What embarrassingly simple aspect of this am I missing?
if ($stmt = $mysqli->prepare("SELECT * FROM teachers WHERE teacher_id = ? LIMIT 1")) {
$stmt->bind_param('i', $id);
$stmt->execute();
$stmt->store_result();
// output = 1 (expected)
echo $stmt->num_rows . "<br />";
$result = $stmt->get_result();
// no output, expecting '5'
echo $result->field_count . "<br />";
// Close statement object
$stmt->close();
}
else {
/* Error */
die ("Prepared Statement Error: " . $mysqli->error);
}