RE: [PHP-WIN] Getting last id from database

From: Date: Thu, 03 Oct 2002 16:56:29 +0000
Subject: RE: [PHP-WIN] Getting last id from database
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-16144@lists.php.net to get a copy of this message
why not select id from poll order by id desc limit 1 HTH Rich -----Original Message----- From: Davy Obdam [mailto:info@davyobdam.com] 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:info@davyobdam.com url: http:///www.davyobdam.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#16144) next »