I am creating a blog post scheduling system using CodeIgniter. I want 10 posts to show up a day. There is a field in the posts
table named scheduled_date
which I will get the posts that are less than or equal to the current date. When an admin user adds a new record to the database, I need an SQL statement that somehow will help me COUNT the number of records with the latest date in the database. For example:
// 9 records returned for the date 2011-01-01 $numbers_of_records == 9; if($numbers_of_records == 10){ // inserts record with `scheduled_date`='2011-01-01' }else{ // inserts record with the date latest date +1 day }
How would I efficiently accomplish this?
Thanks