Re: SELECT Max(FieldName) in PEAR DB problem
| From: | Bertrand Mansion | Date: | Thu, 14 Feb 2002 17:59:35 +0000 |
| Subject: | Re: SELECT Max(FieldName) in PEAR DB problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-859@lists.php.net to get a copy of this message | ||
le 14/02/02 17:22, Simon H à simon.hamilton@ntlworld.com a écrit :
> I'm trying to get the maximum value in a column from a database using
> PearDB. I'm currently using the ODBC for PearDB but will migrate to MySQL
> eventually.
>
> When I use the code below I get the error:
>
> Fatal error: Call to undefined function: fetchrow() in F:/path/to/test.php
> on line 32
>
> The code
> ---------------
> $sqlConnected = "SELECT Max(ConnectedTime) FROM UserInfo WHERE UserName =
> '$Name'";
Maybe you can use aliases here like for instance :
$sqlConnected = "SELECT MAX(ConnectedTime) as MAXCONNECTED FROM UserInfo";
and then call $row[MAXCONNECTED].
Good luck
Bertrand Mansion
Mamasam