I have been hacking away at this all day with only a successful ‘UPDATE’ to show for it. I am new to using MySQLI and seem to be encountering several issues with the script.
A volunteer uses an html form to input their email address, which is already in the database. Then the database reveals their schedule information and updates the ‘confirmed’ column from (default) ‘NO’ to ‘YES’.
The update is showing as confirmed “YES” in the database, however the output isn’t echoing on the page itself.
Here’s the PHP: http://pastebin.com/KSPGuuae
Errors: UPDATE FAILED: () object(mysqli_stmt)#2 (0) { }
select FAILED: () object(mysqli_stmt)#3 (0) { }
Fatal error: Call to undefined method mysqli_stmt::get_result() in
/home/content/79/6007279/html/summerfest/display.php on line 119:
119: $result = $stmt->get_result();
You forgot to run
$stmt->execute()before trying to fetch the result.Also,
get_result()was only introduced in PHP 5.3For prior PHP versions you should use this query:
Then inside PHP:
I prefer the way PDO works, though with PHP 5.3 at least mysqli is more workable.