last row in database?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
volrathxp
Forum Newbie
Posts: 1
Joined: Wed Dec 04, 2002 9:36 pm
Location: Dayton, OH

last row in database?

Post by volrathxp »

I have a question.

I am currently in the process of starting a webcomics site. i'm having a bit of trouble however, i am not as familiar with php as i'd like to be but i do understand some of the mysql stuff for it.

basically i need to know how i can create a page that will interact with the database i have set up for the comics to display the comics and allow the user to browse, but the "latest comic" link always takes the user back to the newest comic. i really do not understand how i'm gonna do this, so if someone could please help i'd appreciate it so much.

thanks!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if you have an auto-increment field in your table (e.g. called id) you might use a query like

Code: Select all

SELECT * from tblName ORDER BY id DESC LIMIT 1
(today is ORDER BY/LIMIT-day ;) )
Post Reply