Be careful - I fell into this trap when I first started doing this sort
of thing. This code will produce an extra element on your array
with value logical false. You need to do ...

While ($array = mysql_fetch_array($result)) $myarray[] = $array;

... to avoid this

Tim Ward
Internet Chess www.chessish.com <http://www.chessish.com> 

        ----------
        From:  Richard Emery [SMTP:[EMAIL PROTECTED]]
        Sent:  29 April 2002 21:57
        To:  Rodrigo Peres; PHP
        Subject:  Re: [PHP] build array dinamicaly

        $query = "SELECT name,address FROM tbl";
        $result = mysql_query($query);
        while($myarray[] = mysql_fetch_array($result);

        ----- Original Message ----- 
        From: Rodrigo Peres <[EMAIL PROTECTED]>
        To: PHP <[EMAIL PROTECTED]>
        Sent: Monday, April 29, 2002 9:20 AM
        Subject: [PHP] build array dinamicaly


        Hi list,

        I want to buil an multidimensional array with the results of Mysql,
but I
        don't know how to do it.
        What I need is:
        "SELECT name,adress from tbl_....."

        array name will receive the names
        array adress will receive the adresses
        and array clientes will contain both, so when i try to access i will
have
        something like $cliente['nome'][0] or $clientes['adress'][1] and so
on.

        Someone can help???

        Thank's in advace

        Rodrigo Peres


        -- 
        PHP General Mailing List (http://www.php.net/)
        To unsubscribe, visit: http://www.php.net/unsub.php

        

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to