note 83284 added to mysqli-stmt.fetch

From: Date: Mon, 19 May 2008 07:27:21 +0000
Subject: note 83284 added to mysqli-stmt.fetch
Groups: php.notes 
Request: Send a blank email to php-notes+get-139513@lists.php.net to get a copy of this message
As php at johnbaldock dot co dot uk mentioned the problem is that the $row returned is reference and not data. So, when you write $array[] = $row, the $array will be filled up with the last element of the dataset. To come up with this you can write the following hack: // loop through all result rows while ($stmt->fetch()) { foreach( $row as $key=>$value ) { $row_tmb[ $key ] = $value; } $array[] = $row_tmb; } ---- Server IP: 85.196.20.153 Probable Submitter: 91.140.31.203 ---- Manual Page -- http://www.php.net/manual/en/mysqli-stmt.fetch.php Edit -- https://master.php.net/note/edit/83284 Del: integrated -- https://master.php.net/note/delete/83284/integrated Del: useless -- https://master.php.net/note/delete/83284/useless Del: bad code -- https://master.php.net/note/delete/83284/bad+code Del: spam -- https://master.php.net/note/delete/83284/spam Del: non-english -- https://master.php.net/note/delete/83284/non-english Del: in docs -- https://master.php.net/note/delete/83284/in+docs Del: other reasons-- https://master.php.net/note/delete/83284 Reject -- https://master.php.net/note/reject/83284 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139513) next »