views:

55

answers:

1

I'm having trouble trying to use $stmt->store_result() after executing a prepared statement. The manual says "Transfers a result set from a prepared statement", but to where?

I would ideally like to use it, all nice an buffered in memory, like mysqli->query() returns.

The php documentation examples make it seem like the only good reason to use store_result() is to get the number of rows.

Ideally, I need something that can get the entire result set from a prepared statment and do something like fetch_rows on it. I DID hack the mysqli_stmt class by extending it and and adding a fetch_assoc function using some backwards methods, but I would really like to remove that hack if I can get all my data buffered into memory.

So I guess my short question is, I know what store_result() does, but how do you USE it?

(And honestly, I wouldn't even be using mysqli->prepare() to get a stmt, if it wasn't so damn useful in preventing sql injection attacks, sterilizing variables, and making my sql look so nice an pretty with all those question marks.)

Thanks for your help!

+1  A: 

It may be useful to take a look at how it's done in Zend_Db

Ian Gregory
Awesome resource! I'll have to pour thought that one. Hopefully I'll find an answer in there.
nolanpro