Find Last Entry In Mysql Database
RegisterLogin
Find Last Entry In Mysql Database
Post Description: Find Last Entry In Mysql Database
Tags: find, last, entry, in, mysql, database
This Post Was Posted On Sep 24, 2009 By normas #2365
Post Description: Find Last Entry In Mysql Database
Tags: find, last, entry, in, mysql, database
This Post Was Posted On Sep 24, 2009 By normas #2365
Find Last Entry In Mysql Database by normas
you see, i have this script i am making, and i have a table with a column called studentId and each student has a unique id. so now i want to find last entry in mysql database.Choosing last entry of MySQL table should be easy i know, but i can't find a query.
as each student signs up, it creates an incremental ID, that field is called studentId, do you know how i can get the last row from mysql database using php?
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
webune
#2366 1
what you need is to add the SORT by in your query for example like this:
$Query = "SELECT StudentName from StudentsTable ORDER BY studentId DESC LIMIT 0,1";
ok, if you run that query, its telling mysql to SELECT StudentName from the StudentsTable.. the key component is the ORDER BY - i want to make it descenting, so i put DESC
and...
since i only want the only the last one, i use LIMIT 0,1
hope that helps
$Query = "SELECT StudentName from StudentsTable ORDER BY studentId DESC LIMIT 0,1";
ok, if you run that query, its telling mysql to SELECT StudentName from the StudentsTable.. the key component is the ORDER BY - i want to make it descenting, so i put DESC
and...
since i only want the only the last one, i use LIMIT 0,1
hope that helps
Sep 24, 2009 Reply Report abuse
©2011 Webune Forums - Wed Dec 21, 2011 2:24 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3