Hi,
I want to be able to stack rows returned from a database query in an array which I can then pass to another file for display.
Here's a sample code of how am trying to achieve this, but it's obviously not working.
by the way am using PDO objects to retrieve the rows.
------------------------------------------------
while($row = $this->obj_db_cnx->safe_fetch_array()) {
$this->ary_result['users'] = $row;
}
------------------------------------------------------
But the when I pass the ary_result['users'] as a parameter to another file, only the last row is displayed.
Please advice.
Thanks.
Stacking rows from a database in an array
Moderator: General Moderators
Re: Stacking rows from a database in an array
try
Code: Select all
while($row = $this->obj_db_cnx->safe_fetch_array()) {
$this->ary_result['users'][] = $row;
}
Re: Stacking rows from a database in an array
Thanks a lot Panic!
it works like a charm
it works like a charm
Re: Stacking rows from a database in an array
No probs at all!
