I need to display a news-tip daily and my table structure as below.
| id | ndate |News Tip |
+------+----------------------+
| 1541 | NULL | news1 |
| 1545 | 14-10-2010 | news2 |
| 1567 | NULL | news3 |
| 1568 | NULL | news4 |
| 1582 | NULL | news5 |
.... ....
| 1702 | NULL | news217 |
and the query select * from newstip where ndate!=NULL and checks whether ndate matches current date its ok. if not i need to update next row (1567 in this case) to current date and all others to NULL.
id is unique but not in sequence so below query not possible.
update newstip set ndate='15-10-2010' where id=(id+1); //failure
How to solve this situation ?. i’m using php to this process;
This won’t update anything if no record has an
id > 1545.