Re: Sanity check on arrays ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 23, 2015 at 10:52 AM, Lester Caine <lester@xxxxxxxxxxx> wrote:

> $ret = array();
>
> while ($res = $result->fetchRow()) {
> Tidy contents of $res array
> $ret[] = $res;
> }
>
> What I expect and what is happening on every other lookup is that
> $ret[0] contains first result array ... on this one there is another
> level being added so $ret[][0] and the following code sees an empty
> array for this data set :(
>
> Can't see anything different to the other working loops so anybody got
> an idea where the extra level materialised from?
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
echo '<pre>'; print_r($ret);

What do you get for that. From what I can see you should be getting
something like:

$ret = array (
    array('id' => 1, 'name' => 'test1'),
    array('id' => 2, 'name' => 'test2'),
);

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux