Re: MAX on a query.

From: Date: Thu, 05 Jun 2003 03:03:42 +0000
Subject: Re: MAX on a query.
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5807@lists.php.net to get a copy of this message
$dataobject->selectAdd('MAX(id) as id '); The Php_kid wrote:
Hi There is a way to make a "SELECT MAX(id) FROM Lotes" with DataObjects ? At the momment I'm getting last result with DB: <?php require_once('DB.php'); // get DSN from DataObjects config File. $options=parse_ini_file($_SERVER['DOCUMENT_ROOT']."/classes/jalilstamps.ini" ); $dsn=$options['database']; $db = DB::connect($dsn); if (DB::isError($db)) { die ($db->getMessage()); } $sql = "SELECT MAX(id) FROM Lotes"; $result = $db->query($sql); $db->disconnect(); $last_id=$result->fetchRow(); $new_id=$ultimo_id[0] + 1; ?> Thank you ! Regards mac -- ...ThE PhP_KiD.


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