mysqli_bind_result
| From: | Ethan Rosenberg, PhD | Date: | Tue, 27 Nov 2012 01:28:44 +0000 |
| Subject: | mysqli_bind_result | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48579@lists.php.net to get a copy of this message | ||
Dear List -
Here is some code:
$sql13 = "SELECT * FROM Intake3 WHERE MedRec = ?";
$stmt = mysqli_stmt_init($cxn);
mysqli_stmt_prepare( $stmt, $sql13 );
$_SESSION['stmt'] = $stmt;
$args = array();
$args[0] = &$_POST['MR'];
$types = 'i';
if( !$stmt )
throw new Exception( 'Error preparing statement' );
// Put the statement and types variables at the front of the params to pass to mysqli_stmt_bind_param()
array_unshift($args, $stmt, $types ); // Note that I've moved this call. Apparently it doesn't pass back the result.
// I guess sometimes I just forget these things.
// mysqli_stmt_bind_param()
if( !call_user_func_array( 'mysqli_stmt_bind_param', $args ) )
throw new Exception( 'Failed calling mysqli_stmt_bind_param' );
if( !mysqli_stmt_execute( $stmt ) )
throw new Exception( 'Error while executing statement' );
mysqli_stmt_bind_result( $stmt, $Site, $MedRec, $Fname, $Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age);
throw new Exception( 'Failed calling mysqli_stmt_bind_result' );
Fatal error: Uncaught exception 'Exception' with message 'Failed calling mysqli_stmt_bind_result'
What is my error??
FYI - MR comes from here --
<center><strong>Do you Wish to Enter Visit Data?</center>
<center>If Yes:</center>
<form name="form2" method="post"><center>Choose the Medical Record that You Wish to Use</strong></center> <form method="post"> <center><input type="text" name="MR"></input></center> <center><input type="submit" value="Enter Medical Record"/></center> <input type="hidden" name="next_step" value="step10" /> </form> Advice and help, please. Ethan