Re: mysqli_bind_result

tamouse mailing lists <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <CAHUC_t8EpRjrv9K3RXwT1rbeefNoB03T9tiKYD8zqSFVg=3Xrg@mail.gmail.com>
On Mon, Nov 26, 2012 at 7:28 PM, Ethan Rosenberg, PhD
<[email protected]> wrote:
> 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
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

From the looks of this, you are calling the throw all the time:

> mysqli_stmt_bind_result( $stmt,  $Site, $MedRec, $Fname, $Lname,> $Phone, $Height, $Sex, $Hx, $Bday, $Age);
> throw new Exception( 'Failed calling mysqli_stmt_bind_result' );

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.