Dear All
The calendar will be used to see when something is booked and you can assign
messages to it as well which the general user cannot see. In this respects I
have created 2 pages - welcome .php for the general viewer and admin_welcome
for the updating of the calendar.
What I would like to do is to be able to enter multiple dates in at the same
time - either saying from a start date for so many days or from a start date
to an end date.
After spending hours looking at the code and in this forum I cannot seem to
get it right - basically I cannot do it.
I was wondering if someone could have a look and tell me where I am going
wrong. (scripts at bottom of page)
ng at
www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.
Any help would be appreciated
Ray
P.S. if any one also knows how to get it to display a 2 or 3 months at a
time or even a year this would also be a bonus as I have tried to do this as
well.
The Scipts:
mySQL Database File
CREATE TABLE tablename (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username varchar(255),
stamp datetime,
subject varchar(255),
description blob,
PRIMARY KEY (id)
);
welcome.php (this is what the end user sees)
";
echo date('F', mktime(0,0,0,$month,1,$year));
echo " $year";
$firstday = date( 'w', mktime(0,0,0,$month,1,$year));
while (checkdate($month,$lastday,$year))
{
$lastday++;
}
$nextmonth = $month+1;
$nextyear = $year;
if ($nextmonth == 13)
{
$nextmonth = 1;
$nextyear = $year + 1;
}
$lastmonth = $month-1;
$lastyear = $year;
if ($lastmonth == 0)
{
$lastmonth = 12;
$lastyear = $year-1;
}
echo "";
echo "
";
echo "
";
echo "";
echo "SunMon
TueWed
ThuFri
Sat";
for ($i=0; $i<7; $i++)
{
if ($i < $firstday)
{
echo "";
}
else
{
$thisday = ($i+1)-$firstday;
if ($currentyear > $year)
{
echo "";
}
else if ($currentmonth > $month && $currentyear == $year)
{
echo "";
}
else if ($currentmonth == $month && $currentday > $thisday && $currentyear
== $year)
{
echo "";
}
else
{
echo "";
}
echo "$thisday
";
$query2 = mysql_query("SELECT subject FROM $mysql_tablename WHERE stamp >=
\"$year-$month-$thisday 00:00:00\" and stamp <= \"$year-$month-$thisday
23:59:59\" ORDER BY stamp");
for ($j = 0; $j$results[subject]";
}
}
if (mysql_num_rows($query2) < 4)
{
for ($j=0; $j<(4-mysql_num_rows($query2)); $j++)
echo "";
}
echo "";
}
}
echo "\n";
$nextday = ($i+1)-$firstday;
for ($j = 0; $j<5; $j++)
{
echo "";
for ($k = 0; $k<7; $k++)
{
if ($nextday < $lastday)
{
if ($currentyear > $year)
{
echo "";
}
else if ($currentmonth > $month && $currentyear == $year)
{
echo "";
}
else if ($currentmonth == $month && $currentday > $nextday && $currentyear
== $year)
{
echo "";
}
else
{
echo "";
}
echo "$nextday
";
$query3 = mysql_query("SELECT subject FROM $mysql_tablename WHERE stamp >=
\"$year-$month-$nextday 00:00:00\" AND stamp <= \"$year-$month-$nextday
23:59:59\" ORDER BY stamp");
for ($i = 0; $i$results2[subject]";
}
else if ($i < 4)
{
echo "";
}
}
echo "";
$nextday++;
}
}
echo "\n";
}
echo "";
?>
admin_welcome.php (this is what the admin uses)
";
echo date('F', mktime(0,0,0,$month,1,$year));
echo " $year";
$firstday = date( 'w', mktime(0,0,0,$month,1,$year));
while (checkdate($month,$lastday,$year))
{
$lastday++;
}
$nextmonth = $month+1;
$nextyear = $year;
if ($nextmonth == 13)
{
$nextmonth = 1;
$nextyear = $year + 1;
}
$lastmonth = $month-1;
$lastyear = $year;
if ($lastmonth == 0)
{
$lastmonth = 12;
$lastyear = $year-1;
}
echo "";
echo "
";
echo "
";
echo "";
echo "SunMon
TueWed
ThuFri
Sat";
for ($i=0; $i<7; $i++)
{
if ($i < $firstday)
{
echo "";
}
else
{
$thisday = ($i+1)-$firstday;
if ($currentyear > $year)
{
echo "";
}
else if ($currentmonth > $month && $currentyear == $year)
{
echo "";
}
else if ($currentmonth == $month && $currentday > $thisday && $currentyear
== $year)
{
echo "";
}
else
{
echo "";
}
echo "$thisday
";
$query2 = mysql_query("SELECT subject FROM $mysql_tablename WHERE stamp >=
\"$year-$month-$thisday 00:00:00\" and stamp <= \"$year-$month-$thisday
23:59:59\" ORDER BY stamp");
for ($j = 0; $j$results[subject]";
}
}
if (mysql_num_rows($query2) < 4)
{
for ($j=0; $j<(4-mysql_num_rows($query2)); $j++)
echo "";
}
echo "";
}
}
echo "\n";
$nextday = ($i+1)-$firstday;
for ($j = 0; $j<5; $j++)
{
echo "";
for ($k = 0; $k<7; $k++)
{
if ($nextday < $lastday)
{
if ($currentyear > $year)
{
echo "";
}
else if ($currentmonth > $month && $currentyear == $year)
{
echo "";
}
else if ($currentmonth == $month && $currentday > $nextday && $currentyear
== $year)
{
echo "";
}
else
{
echo "";
}
echo "$nextday
";
$query3 = mysql_query("SELECT subject FROM $mysql_tablename WHERE stamp >=
\"$year-$month-$nextday 00:00:00\" AND stamp <= \"$year-$month-$nextday
23:59:59\" ORDER BY stamp");
for ($i = 0; $i$results2[subject]";
}
else if ($i < 4)
{
echo "";
}
}
echo "";
$nextday++;
}
}
echo "\n";
}
echo "";
echo "";
echo "
";
?>
operate.php (this is the page to add / delete etc)
You can't de