on 15/11/02 8:11 PM, Tim Thorburn ([EMAIL PROTECTED]) wrote: > I'm creating a form which will allow individuals to add themselves to an > online database and ask if they'd like to upload a picture. I have the > form setup which allows the individuals to add themselves - currently it > asks if they have a picture to upload (a yes or no drop menu). On the > screen after the individual adds them self, I'd like to check the database > for the last entry (the one just made) and then see if the picture column > has a yes or a no stored. > > What I don't know is how to select the last entry in a database ... I'm > sure its something very simple, but with being up until 5am working on this > site - it's slipped by caffeine powered brain.
To answer your question first, assuming you have an numeric, unique id column, you would do something like SELECT * FROM tablename ORDER BY id DESC LIMIT 1 BUT, it's *possible* that another row could be inserted before you get the chance to check... the real key here (assuming you are using MySQL) is to use mysql_insert_id(). Justin French -------------------- http://Indent.com.au Web Developent & Graphic Design -------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php