Re: mysqli, prepare and fetch_row

From: Date: Wed, 22 Oct 2008 20:42:06 +0000
Subject: Re: mysqli, prepare and fetch_row
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-282294@lists.php.net to get a copy of this message
You prepare the statement, execute it then use ->fetch() to get the data. On Oct 22, 2008, at 1:36 PM, Marten Lehmann <lehmann@cnm.de> 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


« previous php.general (#282294) next »