![]() |
Trying to display a div if date is today or greater
Hi Guys,
I'm a novice at this and i'm bloody stuck! Basically i want to display a div if theres a record in a table from either todays date or in the future. Here comes my very bad code..... Code:
<?php |
Where is the date that you wish to compare? I assume you need to extract it from a field of your table.
I'm assuming, also, that it should be exec_db_query etc. Actually, this is probably your own function, so ignore this line. |
1 Attachment(s)
Basically theres a bunch of dates in a row, if there is data in another row next to it which has a date of Today or Now or greater i want that div to display.
i've attached a screenshot which might explain better. Thanks mate! |
It's slightly confusing as your code refers to 'week_special_rate' but the field in your table is named 'special_offer'..
Anyway, I believe you need a query like: SELECT special_offer FROM yourtable WHERE `date` > NOW() or SELECT special_offer FROM yourtable WHERE `date` > NOW() and special_offer > 0 It might be more complicated if your 'date' field is a string. BTW (Personally) I wouldn't use 'date' as a field-name - it can only lead to trouble or confusion later ;) |
lol i give you the screenshot of a different table, i think this should be an if statement. basically i need to know how to write this in php.
if in a row column "week_special_rate" contains any data other than 0 and "start_date" column is today or in the future then display div |
I managed to get it to work in the end with this code:
Code:
<?php |
| All times are GMT +1. The time now is 12:34 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.