You prepare the statement, execute it then use ->fetch() to get the data.

On Oct 22, 2008, at 1:36 PM, Marten Lehmann <[EMAIL PROTECTED]> wrote:

Hello,

I have a small piece of code where I'm trying to use mysqli with a prepare-statement. I don't want to bind variables for the fetch, instead I want to use something like

list($question) = $stmt->fetch_row();

And this fetch_row should exist according to the documentation. But while mysqli_query returns a result-handle, mysqli_prepare does not. So where do I get it from?

$stmt = $mysqli->prepare("select question from faq_article where id = ?");
$stmt->bind_param("i", $_REQUEST["id"]);
$result = $stmt->execute();
print_r($result);

returns "1" but not a result-handle.

list($question) = $stmt->fetch_row();

doesn't work also, the error message says, that there is no function fetch_row in a statement handle. Thats correct, but how do I get a result-handle?

Regards
Marten

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to