Hi,
I'm writing a db abstraction layer driver for MySQLi. I'm glad to finally get a chance to play around with these new functions, but am completely stumped by this question:
Is there no way to get back a standard resultset when using prepared statement queries?
I can't believe this would be the case, but it seems that the only option when using prepared statements is to call myslqi_stmt_bind_result(), binding results to php variables and then call mysqli_stmt_fetch($stmt) until it returns null. i.e.
$sql = "SELECT name, age FROM friends WHERE country = ?"; $stmt = mysqli_prepare($link, $sql);
$country = "Haiti"; mysqli_bind_param($stmt, "s", $country);
mysqli_stmt_execute($stmt);
/* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $age);
/* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf ("%s (%s)\n", $name, $code); }
What I want to be able to do is use things like mysqli_fetch_assoc() instead of this weird, side-effect-prone mysqli_stmt_fetch() to retrieve the results.
I don't see the solution, but I hope I'm just missing something because I've been staring at it too long.
Thanks in advance, Hans
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php