Re: #18634 [NEW]: Pear DB query w/ sql's MAX() Returns wrong array handles
| From: | Brad Bulger | Date: | Tue, 30 Jul 2002 04:35:50 +0000 |
| Subject: | Re: #18634 [NEW]: Pear DB query w/ sql's MAX() Returns wrong array handles | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8083@lists.php.net to get a copy of this message | ||
that looks like correct behavior to me, "min(time)" is what mysql would
name the column:
mysql> create table b18634 (x int, y timestamp);
Query OK, 0 rows affected (0.07 sec)
mysql> insert into b18634 (x) values (1);
Query OK, 1 row affected (0.14 sec)
mysql> insert into b18634 (x) values (2);
Query OK, 1 row affected (0.00 sec)
mysql> select min(y) from b18634;
+----------------+
| min(y) |
+----------------+
| 20020729213817 |
+----------------+
if you want it to be called 'time', name it that in the query:
mysql> select min(y) as y from b18634;
+----------------+
| y |
+----------------+
| 20020729213817 |
+----------------+
On 30 Jul 2002 starr@evilemail.com wrote:
> 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'];
>
> --
> Edit bug report at http://bugs.php.net/?id=18634&edit=1
> --
> Fixed in CVS:
> http://bugs.php.net/fix.php?id=18634&r=fixedcvs
> Fixed in release:
> http://bugs.php.net/fix.php?id=18634&r=alreadyfixed
> Need backtrace:
> http://bugs.php.net/fix.php?id=18634&r=needtrace
> Try newer version:
> http://bugs.php.net/fix.php?id=18634&r=oldversion
> Not developer issue:
> http://bugs.php.net/fix.php?id=18634&r=support
> Expected behavior:
> http://bugs.php.net/fix.php?id=18634&r=notwrong
> Not enough info:
>http://bugs.php.net/fix.php?id=18634&r=notenoughinfo
> Submitted twice:
> http://bugs.php.net/fix.php?id=18634&r=submittedtwice
> register_globals:
> http://bugs.php.net/fix.php?id=18634&r=globals
>
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>