PHP Bind Statements a tiny get_result() nightmare

3
Leave a Reply

avatar
2 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
adminHussain Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Hussain
Guest
Hussain

Something is not quite right. Doing vardumps along the way, by statement fetches 4 records. After passing it through these functions, I get an array of 4 rows. However, each of them contains the last record which was returned from the query.
In the loop above:
$row=$this->getResultFix($statement);
while ($statement->fetch()) {
array_push($all_rows, $this->arrayCopy($row));
}

The getResultFix assigns the row values outside the loop but $row isn’t assigned anything within the loop. Is it because of a callback within call_user_func_array which is updating newly fetched values to $row?

Hussain
Guest
Hussain

Something is definitely odd.
var_dump($row) within the while loop shows the the values being pushed are: rec1, rec2, rec3, rec4.
var_dump($all_rows) immediately after that loop shows: rec4, rec4, rec4, rec4