On Mon, 2007-07-16 at 10:52 -0400, Robert Cummings wrote:
> On Mon, 2007-07-16 at 07:41 -0700, Andras Kende wrote:
> > Hello,
> > 
> > I use the following GetArray for returning an array from mysql results.
> > 
> > But having a hard time modifying it for returning a simple associative array
> > 
> > Like:
> > 
> > $conn->GetAssoc('SELECT id, name from manufacturers')
> > 
> > Array ( [2] => BMW [1] => MAZDA [9] => FORD )
> > 
> > 
> >             function GetArray($query) {
> >                     $get = $this->Execute ( $query );
> >                     
>                           $result = array();
> >                     while ( $row = mysql_fetch_array($get) ) {
>                                   $result[] = $row;
> >                     }
> >                     mysql_free_result($get);
> >                     
> >                     return $result;
> >             }
> > 
> > 
> >             function GetAssoc($query) {
> >                     $get = $this->Execute ( $query );
> >                     
>                           $result = array();
> >                     while ( $row = mysql_fetch_array($get) ) {

You should probably use mysql_fetch_assoc() in the above line.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

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

Reply via email to