Jump to content

[SOLVED] Checking two separate date variables


TutorMe

Recommended Posts

I have two variables stored in a database.  They are "month," and "day."  Currently, I type the "month" variable into the code manually, and update that each month.  I then use a code to see if the "day" variable matches the day it is.  This is the code:

if ($row['day'] == date('d'))

.

 

I would like to make this code more automated by having it check both variables, but since the "month," and "day" variables are stored in two separate rows instead of together as "month/day," I am running into trouble.

 

I have tried things like this:

if ($row['month'] . '/' . $row['day'] == date('m/d'))
$list = $row['username'] . " ";

, but nothing seems to work.  Does anybody have any ideas on how to do this?

Link to comment
Share on other sites

if ($row['month'] == date('n') && $row['day'] == date('j'))

Thanks, but why would you use "n" and "j"?

 

Also, another problem I have run into is that the "month" variable is stored as "January, February, etc...."  Since the date function returns a number, I am again stuck.  Any ideas are appreciated.

 

Thanks again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.