Hi Chris,
On Wed, 26 Jun 2002, Chris Payne wrote:

> Hi there everyone,
>  
> How Can I grab just the LAST ID from a database in MySQL with PHP
> easily?

<?
 If(last id == max id) 
 {
        // then   use this query:
        SELECT max(id) from my_table;
 }
 else if (last id == the last data in the table) {
         // then   use this query:
 SELECT id FROM my_table ORDER BY id DESC limit 1;
 }

:-)

Best regards.
-- 

Devrim GUNDUZ

[EMAIL PROTECTED]
[EMAIL PROTECTED]

Web : http://devrim.oper.metu.edu.tr
-------------------------------------





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to