preparing statements & mysqli

From: Date: Mon, 27 Sep 2004 04:39:25 +0000
Subject: preparing statements & mysqli
Groups: php.db 
Request: Send a blank email to php-db+get-36415@lists.php.net to get a copy of this message
Is it possible to use mysqli's prepare/bind/execute functions, and be able to use mysqli's normal mysqli_fetch_* functions, to retrieve data from the prepared statements?? With the provided example, Im getting -> Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in C:\Program Files\Apache\.....index.php on line 9 NULL Granted, $stmt is an object and I need a resource, Im trying to duplicate a scenario where a db extention can use its fetch functions to work with its prepare functions. For example, in the ODBTP (and I think the OCI8) extension, they are able to use their fetch functions with prepared statements. From what Im seeing in the documentation, one is forced to either use the normal functions, or *prepared statement* functions. Im hoping that my assesment is wrong. Thanks -- $conn = mysqli_connect('localhost', '***', '***', '***'); $sql = 'SELECT * FROM table where id = ?'; $foo = 'abc'; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, 's', $foo); mysqli_stmt_execute($stmt); var_dump(mysqli_fetch_array($stmt)); ---

« previous php.db (#36415) next »