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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.