Jump to content

birthday issues


tara_irvine

Recommended Posts

ok I'm in desperate need of help.

I've developed this form that a user can enter family birthdays into a database, the code is along the lines of

				<?php
			$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June','July', 'August', 'September', 'October', 'November', 'December');
			$days = range (1, 31);
			$years = range (1920, 2008);
			echo "<select name='day'>";
			echo '<option>Day</option>\n';
			foreach ($days as $value) {
			echo '<option value="'.$value.'">'.$value.'</option>\n';
			} echo '</select><br />';
				echo "<select name='month'>";
				echo '<option>Month</option>\n';
				foreach ($months as $value) {
				echo '<option value="'.$value.'">'.$value.'</option>\n';
				} echo '</select><br />';
					echo "<select name='year'>";
					echo '<option>Year</option>\n';
					foreach ($years as $value) {
					echo '<option value="'.$value.'">'.$value.'</option>\n';
					} 
			?>

my first question is how do I insert the value of these results into an array as a time code?

 

The reason this is important is because I need stuff to come out of the database if the birthday is between todays date and one month 14 days time. This is so the user can see that say her brothers birthday is coming up.

 

$todays_date = strtotime("today 00:00:00",time());
$target_date = strtotime("-1 month 14 days 00:00:00",time());
$MySQLquery = "SELECT * from hobby WHERE username = '$sessionuname' && `date` <= $todays_date && `date` >= $target_date";  

 

Firstly does this make sense? and secondly since PHP is my vice will it work?

 

Thanks so much for any help

xo

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.