| Gerard Samuel 2004-09-27, 3:55 am |
| 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));
---
|