why not select id from poll order by id desc limit 1
HTH Rich -----Original Message----- From: Davy Obdam [mailto:[EMAIL PROTECTED]] Sent: 03 October 2002 16:58 To: Php-Windows Mailing Subject: [PHP-WIN] Getting last id from database 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:[EMAIL PROTECTED] url: http:///www.davyobdam.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php