How Select Last Row In A Database

RegisterLogin
How Select Last Row In A Database
Post Description: If You Use Mysql For Your Php Script You Will Find This Short Tutorial Helpful Because It Hels You Selecting The Last Row In A Table
Tags: How, Select, Last, Row, In, A, Database
This Post Was Posted On Oct 19, 2009 By Webune Support #2598
hi, welcome to webune support forums. today we will teach you something very important when creating your php scripts using a MySQL database.

for example, lets say we want to get the last row in a MySQL database table, so how can we do this? easy.

for the purpose of this short tutorial, lets say i want to select the last user that signed up to our forums. this is how i would do it:

PHPCODE:
$query = "SELECT username from users ORDER BY user_id DESC LIMIT 0,1";


that will give you the LAST username in my users table

hope that helps.. REMEMBER, if you need quality PHP/MySQL web hosting, Webune is always here for you.

thanks
Webune Support Team
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Sun Dec 18, 2011 6:55 pm
Powered by: Webune Forums V3