<?php
include ("connection.php");

$result = mysql_query( "SELECT * FROM tblcalendar WHERE intId = $id" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
	$day = $a_row->intDay;
	$month = $a_row->intMonth;
	$year = $a_row->intYear;
}

$query = "UPDATE tblcalendar SET ynEmail = '1', intHoursBefore = '$hours' WHERE intId = '$id'";

mysql_query( $query, $link )
or die ( "Could not update in \"tblcalendar\" table: "
.mysql_error() );

header("Location: calendardayall.php?day=$day&month=$month&year=$year");
exit;