Re: [PHP] mysqli, prepare and fetch_row
Hi, Kyle Terry wrote: Why don't you want to bind the results? thats poor programming style and bad performance (dozends of bind calls). Since there is a method fetch_row(), then why shouldn't I use it? It is a bit strange that I cannot find any example for its use besides in conjunction with silly -query(), which doesn't allow to bind parameters with ?. Regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysqli, prepare and fetch_row
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
Re: [PHP] mysqli, prepare and fetch_row
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
Re: [PHP] mysqli, prepare and fetch_row
Hi, You prepare the statement, execute it then use -fetch() to get the data. but the documentation says, that -fetch() is only to fetch data to variables that have been bound with bind_result() before. But I want to use fetch_row() instead. Regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php