Re: Re: #18634 [NEW]: Pear DB query w/ sql's MAX() Returns wrong array handles

From: Date: Tue, 30 Jul 2002 07:13:48 +0000
Subject: Re: Re: #18634 [NEW]: Pear DB query w/ sql's MAX() Returns wrong array handles
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-8085@lists.php.net to get a copy of this message
IMHO it's not a bug at all, just write proper SQL ! $sql = "SELECT MIN(time) from mytable" Means that you want a column named MIN(time) as the result column $sql = "SELECT MIN(time) as time from mytable" Returns the result in a column 'time' Which columns do you expect with the following line: $sql = "select a,b,c from mytable" $row['a'] $row['b'] $row['c'] or $row['this is column a'] $row['this is column b'] $row['this is column c'] I presume that you expect the first, but why? Well, because you wrote select a,b,c from mytable, which brings us back to the starting point. Steen "Vitaly N. Kravchenko" <kvn@phbme.ntu-kpi.kiev.ua> wrote: > Hello, starr@evilemail.com! > > > IMHO, It's bug of mySQL or mySQL native API in PHP, > and not PEAR::DB. > > > > > From: starr@evilemail.com > > Operating system: NT 4 > > PHP version: 4.2.2 > > PHP Bug Type: PEAR related > > Bug description: Pear DB query w/ sql's MAX() Returns > wrong array handles > > ...Pear DB / Mysql / $db is a pear db object > > Using a mysql query w/ MIN() --- i.e. the following > > $sql = "SELECT MIN(time) from mytable"; > > $time = $db->getAll( $sql, DB_FETCHMODE_ASSOC ); > > Returns a value in > > $time[0]['MIN(time)']; > > NOT in > > $time[0]['time']; > > > -- > Best regards, KVN. > PHP4You (<http://php4you.kiev.ua/>) > PEAR [ru] (<http://pear.php.net/manual/ru/>) > mailto:kvn@php.net > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.dev (#8085) next »