Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: 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.

  2. #2
    Join Date
    Jun 2003
    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
    NOW() > start_date_field_name
    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.

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

    hope this gets you going in the right direction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts