Posted by TKirahvi on 04/02/07 06:34
Why can't I create Objects in an Array within for/while loop?
If I have:
Code:
$galleries = array();
while( $db->next_record() )
{
$foo = $db->f('id');
$galleries[] = new Gallery($foo);
}
Database query returns two id's and galleries array should then
contain two Gallery Objects but it contains only the first one.
If I do it like this, it works fine:
Code:
$galleries[] = new Gallery(1);
$galleries[] = new Gallery(2);
I have PHP 5.1.6
Thanks in advance
Navigation:
[Reply to this message]
|