SELECT Max(FieldName) in PEAR DB problem

From: Date: Thu, 14 Feb 2002 16:22:38 +0000
Subject: SELECT Max(FieldName) in PEAR DB problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-856@lists.php.net to get a copy of this message
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'"; $resultConnected = $dsn2->query( $sqlConnected ); while ($rowConnected = $resultConnected->fetchRow(DB_FETCHMODE_ASSOC)) // <<<<<---Line 32 { $Max_Connected = $rowConnected[ConnectedTime]; echo $Max_Connected; } --------------- I'm guessing this is because the "Max" function isn't supported, since it works fine with out it. If it does, can someone explain how I can use it, OR, how to achieve the same result with not too much work. If it requires arrays and stuff, please assume my level of PHP to be very basic. BTW the "Max" function works fine with ODBC direct ...Does it work in MySQL anyway? Thanks Simon H

« previous php.pear.general (#856) next »