Getting last id from database
| From: | Davy Obdam | Date: | Thu, 03 Oct 2002 15:57:32 +0000 |
| Subject: | Getting last id from database | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-16142@lists.php.net to get a copy of this message | ||
Hiya people,..
I have a script and i need to get the last id from the database. I have
to get this id to determine whats the latest poll and display that poll
on the page. Now i use this:
if(!$poll)
{
$select = mysql_query("SELECT id FROM poll");
$poll = mysql_num_rows($select);
}
Well everything goes alright if u dont remove any polls.. this just
counts the mumber of rows in the database. Can anyone help me with and
idea how to get the latest id from the database, so that i am able to
delete polls from the database. I ve tried mysql_insert_id(); but i cant
get it to work. Thanks already for your help.
Thanks,..
Davy Obdam
mailto:info@davyobdam.com
url: http:///www.davyobdam.com