Edit report at http://bugs.php.net/bug.php?id=34948&edit=1
ID: 34948 Updated by: abedf...@php.net Reported by: max at webscript dot ru Summary: mysqli_statement and binding array -Status: To be documented +Status: Closed Type: Feature/Change Request Package: MySQLi related Operating System: WinXP Pro PHP Version: 5CVS-2005-10-21 (snap) Assigned To: abedford Block user comment: N Private report: N New Comment: Added docs for mysqli_stmt_get_result. Previous Comments: ------------------------------------------------------------------------ [2011-03-23 16:29:38] abedf...@php.net Automatic comment from SVN on behalf of abedford Revision: http://svn.php.net/viewvc/?view=revision&revision=309605 Log: Add docs for mysqli_stmt_get_result. Fixes #34948 ------------------------------------------------------------------------ [2011-01-06 15:12:22] u...@php.net Functionality exists. Probably since 5.3.0. MySQLiStatement::get_result() needs to be documented as it seems. $m = new mysqli("localhost", "root", "root"); $s = $m->prepare("SELECT ? FROM DUAL"); $hello = 'hello'; $s->bind_param("s", $hello); $s->execute(); $r = $s->get_result(); var_dump($r->fetch_all()); ------------------------------------------------------------------------ [2011-01-06 15:11:16] u...@php.net Functionality exists as of PHP 5.3.x (x = 0, probably). Not properly documented. MySQLiStatement::get_result() needs to be documented. $m = new mysqli("localhost", "root", "root"); $s = $m->prepare("SELECT ? FROM DUAL"); $hello = 'hello'; $s->bind_param("s", $hello); $s->execute(); $r = $s->get_result(); var_dump($r->fetch_all()); ------------------------------------------------------------------------ [2005-10-21 17:26:17] max at webscript dot ru Description: ------------ Binding array for results of prepared statments in mysqli. Reproduce code: --------------- now if I want to work with result of prepared statements I should use mysqli_bind_result(). And if i use table with many columns i need to write variable for all this columns : ----- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); ----- I think it would be better to make function mysqli_bind_result_array($stmt, $array, $array_type); Where $stmt - mysqli_statement $array - array, where we will save data from query $array_type = MYSQLI_ASSOC || MYSQLI_NUM || MYSQLI_BOTH I know, that this can be emulated with mysqli_fetch_fileds() + call_user_func_array() but it's not comfortable :-) Expected result: ---------------- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); mysqli_bind_result_array($stmt, $row, MYSQLI_ASSOC); mysqli_fetch($stmt); ... now $row will contain data from one record of our query Actual result: -------------- no result yet ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=34948&edit=1