PHP and Mysql, getting the last row in a table
Is there any simple ways to pull out the last row in a table. (I want the largest 'Primary Key'). I was wondering if there were any mysql functions to automaticly select the last row in a table.
Thanks
------------------
Visit the dLo.Network
http://dlo.net
Anonymous posted this at 05:39 — 31st March 2000.
They have: 5,633 posts
Joined: Jan 1970
Hi Randall,
I have been looking for the same thing - but, I have never found a command that will do it. I have just worked around it. It depends on what you need the last row for and what you plan to do with the information on the row.
PHP does have a command that allows you to get the results of the last query that may help if you insert the last row right before needing to use it. Don't know if that will work or not.
I really would like to know if there is some type of function, whether it be of mySQL or PHP, that will take care of this as well... If anyone has the secret, please share!
------------------
TWF Administrator
Looking for Web Hosting Services?
Dynamic Internet Solutions : http://www.dids.com
Windows NT and UNIX Hosting ($9.95 - $399.95), Dedicated Servers, and Co-Location Programs
Blur posted this at 19:24 — 6th April 2000.
They have: 66 posts
Joined: May 1999
As far as selecting the last row, why not make an id column:
Ed Aronyk (Blur)
Divergent Digital Media
The secret of success is sincerity. Once you can fake that, you've got it made.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.