You are here: simple events calendar using mysql « PHP Programming Language « IT news, forums, messages
simple events calendar using mysql

Posted by jsd219 on 10/31/07 02:46

Hello all, this may sound very elementary and i am sorry for that. I
am struggling with a very simple calendar for my web site. I already
have the database set up and the admin to input events and i have a
way to display the calendar. the problem i am having is querying and
linking my events from the database to the calendar. I have looked at
all the stock calendars out there and what they offer i do not need. i
have gone through what seems to be every tutorial for calendars but
none of which teach how to query and create the links. here is the
code to display the calendar:

$date =time () ;

$day = date('d', $date) ;
$month = date('m', $date) ;
$year = date('Y', $date) ;

$first_day = mktime(0,0,0,$month, 1, $year) ;

$title = date('F', $first_day) ;

$day_of_week = date('D', $first_day) ;

switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}

$days_in_month = cal_days_in_month(0, $month, $year) ;

echo "<table border=1 width=294>";
echo "<tr><th colspan=7> $title $year </th></tr>";
echo "<tr><td class=month width=42>Sun</td><td class=month
width=42>Mon</td><td class=month width=42>Tue</td><td class=month
width=42>Wed</td><td class=month width=42>Thu</td><td class=month
width=42>Fri</td><td class=month width=42>Sat</td></tr>";

$day_count = 1;

echo "<tr>";

while ( $blank > 0 )
{
echo "<td></td>";
$blank = $blank-1;
$day_count++;
}

$day_num = 1;

while ( $day_num <= $days_in_month )
{
echo "<td> $day_num </td>";
$day_num++;
$day_count++;

if ($day_count > 7)
{
echo "</tr><tr>";
$day_count = 1;
}
}

while ( $day_count >1 && $day_count <=7 )
{
echo "<td> </td>";
$day_count++;
}

echo "</tr></table>";

?>

If anyone can please show me how to query and link my events i would
really appreciate it.

God bless
jsd219

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация