Re: simple events calendar using mysql



On Oct 31, 10:57 am, "Shelly" <sheldonlg.n...@xxxxxxxxxxxxxxxx> wrote:
jsd219 wrote:
On Oct 31, 6:33 am, "Shelly" <sheldonlg.n...@xxxxxxxxxxxxxxxx> wrote:
"jsd219" <i...@xxxxxxxxxxxxxxxxxxxxxx> wrote in message

news:1193798764.191193.112080@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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

Just what is it that you are "querying"? IOW, what is it that you
want to have happen?

Shelly

the calendar is for a mission group, it is mission trips that are in
the database and i would like the calendar to display the trip title
on the appropriate date as a link that opens a popup window with the
trip information. my database has is:

name: calendar
fields: id, title, date, text

Then do a query with
$q = "select * from calendar where id=" . $id;
where $id is the one you want. Then work on the result to fetch the values
of each field. Then use an echo statement enclosed with <?php ?> for the
value of the particular field in the html document.

Shelly

My appologies, i know how to do the query but i do not know how to
tell the code to display the title and a link to a trip that matches
the date. in other words where in the code below do i say ok, now that
the calendar is displayed, if 10/31/2007 has a trip in the database
with the same date display the trip title and link it to open a popup
window with the trip details?

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>";

//This counts the days in the week, up to 7
$day_count = 1;

echo "<tr>";
//first we take care of those blank days
while ( $blank > 0 )
{
echo "<td></td>";
$blank = $blank-1;
$day_count++;
}

//sets the first day of the month to 1
$day_num = 1;

//count up the days, untill we've done all of them in the month
while ( $day_num <= $days_in_month )
{
echo "<td> $day_num </td>";
$day_num++;
$day_count++;

//Make sure we start a new row every week
if ($day_count > 7)
{
echo "</tr><tr>";
$day_count = 1;
}
}

//Finaly we finish out the table with some blank details if needed
while ( $day_count >1 && $day_count <=7 )
{
echo "<td> </td>";
$day_count++;
}

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

God bless
jason

.



Relevant Pages

  • Re: Poll: Is a calendar tabular?
    ... Don't confuse display with the underlying data. ... The pont I was making was that, in document markup in HTML you would ... use a table to contain calendar 'data' and in a database you would use ... But you wouldn't create a database ...
    (comp.infosystems.www.authoring.html)
  • Re: Exchange Calendar Issue
    ... Date mismatch for calendar items. ... Use Isinteg.exe to fix the Pub1.edb database and the Priv1.edb ... Microsoft CSS Online Newsgroup Support ... <public folder in Exchange 2003 SP2 ...
    (microsoft.public.windows.server.sbs)
  • Re: Calendar Form
    ... Doug Steele, Microsoft Access MVP ... My Calendar form opens, and I can add information into it, as well as ... The fact that the previous line (Dim db As DAO.Database) doesn't cause ... I am creating a database for a security company. ...
    (microsoft.public.access.forms)
  • Re: Calendar Form
    ... Doug Steele, Microsoft Access MVP ... My Calendar form opens, and I can add information into it, as well as ... The fact that the previous line (Dim db As DAO.Database) doesn't ... I am creating a database for a security company. ...
    (microsoft.public.access.forms)
  • Re: Calendar Help! -- Before I Screw Up My T5
    ... Every other app I've tried seems to run fine, so I suspect it's a glitch in the calendar app or a corrupted database. ... If the data is OK on the desktop, then hotsyncing should restore all your data onto the Palm, and if there is some corruption in the database, then hopefully recreating it will cause that to go away. ... creator code which matches up with the application's creator code. ...
    (comp.sys.palmtops.pilot)