jamesyrawr Posted December 25, 2010 Share Posted December 25, 2010 can someone please give me some guidance on how to do this please I am wanting to create a status updating type application on my site and i have this idea in my head i want it to retrive and print the last 3 posts (max ids) made by the user if someone could give me some example code please and i can hopefully work from that. Thanks James Link to comment https://forums.phpfreaks.com/topic/222623-php-print-top-3-id-rows/ Share on other sites More sharing options...
dragon_sa Posted December 25, 2010 Share Posted December 25, 2010 $query="SELECT * FROM table ORDER BY max_ids DESC LIMIT 3"; if you want for a particular user where you have set the variable of the userid $query="SELECT * FROM table WHERE userid='$userid' ORDER BY max_ids DESC LIMIT 3"; Link to comment https://forums.phpfreaks.com/topic/222623-php-print-top-3-id-rows/#findComment-1151310 Share on other sites More sharing options...
revraz Posted December 25, 2010 Share Posted December 25, 2010 If you want the last 3 posts, then you would need to order by DATE. Link to comment https://forums.phpfreaks.com/topic/222623-php-print-top-3-id-rows/#findComment-1151313 Share on other sites More sharing options...
dragon_sa Posted December 25, 2010 Share Posted December 25, 2010 If max_ids is an auto increment unique id then that would suffice, if not then would need to use timestamp for date as suggested by revraz Link to comment https://forums.phpfreaks.com/topic/222623-php-print-top-3-id-rows/#findComment-1151315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.