Page 1 of 1
latest post to the front page in php
Posted: Wed Feb 11, 2009 10:56 am
by tat
Guys,
Any idea how I could code in php so that the latest 10 posts make it to the index page?
Any guidance will be appreciated.
Thanks
Re: latest post to the front page in php
Posted: Wed Feb 11, 2009 11:09 am
by mattpointblank
SELECT * FROM posts ORDER BY postID DESC LIMIT 10
Re: latest post to the front page in php
Posted: Wed Feb 11, 2009 11:23 am
by tat
wow that easy? I just need a query? thanks a lot
Re: latest post to the front page in php
Posted: Wed Feb 11, 2009 11:28 am
by mattpointblank
Well, you'll have to then loop through the results using mysql_fetch_array and do something with them, and obviously adapt the query to fit your database structure. But yeah, in principle it's simple.