开发者

How to hide records when the date has passed?

I am unsure on how to check whether a date has passed in order to only show rows where the date has not passed.

I am using CodeIgniter and when the date is set, I'm not using a date type (using varchar) in the MySQL table as I'm using 开发者_JS百科the jQuery date-picker to set the date.

So when the date is set, I need to pull the date from the table to check whether the date has passed or not?

So I'm not sure whether I have to totally change my date input to use the date type in the MySql table in order to pull the date and check whether it is < now()

Any guidance or advice would be extremely appreciated :)


Is there any particular reason for NOT using the date type in MySQL? If is a date, why not store it as a date? It will still be usable as a string in your PHP script when you retrieve it from the database.


You should always use the date type in MySQL if you are tracking dates, that way you have all the date functions available to you. The date functions of MySQL are much faster than trying to parse them as text with PHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜