On Mon, Nov 26, 2012 at 7:28 PM, Ethan Rosenberg, PhD
<erosenb...@hygeiabiomedical.com> 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

Reply via email to