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
https://forums.phpfreaks.com/topic/102692-birthday-issues/
Share on other sites

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.