Date: 06/26/02
- Next message: Cosby, Christopher: "RE: [PHP-DB] Last ID from database?"
- Previous message: Juan Pablo Aqueveque: "Re: [PHP-DB] Last ID from database?"
- In reply to: Chris Payne: "[PHP-DB] Last ID from database?"
- Next in thread: Cosby, Christopher: "RE: [PHP-DB] Last ID from database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
devrim <email protected> devrim.gunduz <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
- Next message: Cosby, Christopher: "RE: [PHP-DB] Last ID from database?"
- Previous message: Juan Pablo Aqueveque: "Re: [PHP-DB] Last ID from database?"
- In reply to: Chris Payne: "[PHP-DB] Last ID from database?"
- Next in thread: Cosby, Christopher: "RE: [PHP-DB] Last ID from database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

