If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > show button during certain dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-03, 15:57
knighthawk1337 knighthawk1337 is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
show button during certain dates

on my website I have a submit button that i'm using as a link. I only want this button to show up during certain dates. I have an sql database set up with the starting and ending dates entered. I want the button to show up durring and between these dates. How can I do this with PHP? no one else can help me so I hope someone here can.
Reply With Quote
  #2 (permalink)  
Old 12-02-03, 18:43
jbroder jbroder is offline
Registered User
 
Join Date: Jun 2003
Posts: 20
Well, you could do a select on the mysql table using the builtin today's date and time function called NOW()

SELECT * FROM datetable_name_here
WHERE
NOW() > start_date_field_name
AND
NOW() < end_date_field_name

If you get any rows, then it is between those dates. try this on the sql command line first, before using php.

You may need to use the to_days function to convert these dates to "number of dates between" to make this sql work.

ex:
to_days(NOW()) - to_days(start_date_field_name) > 0


hope this gets you going in the right direction
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On