How to write a query to retrieve the last record that is entered. ???

Recommended Answers

All 3 Replies

I do not know if this can help you, but if you have a date field which you can order by desc, then you can use Top 1 something like this.

Select top 1 Field1
from table1
order by datefield desc

if you dont have a date maybe have a index field that is the easiest way to do that.
regards

no u just have an id column that auto increments then ur like mysql_query("SELECT MAX(id) FROM table or something

if you have an auto increment field, just use mysql_insert_id() to get the last auto increment

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.