Jump to content

event calendar help


rockindano30

Recommended Posts

hello all

 

trying to finish my event calendar but stuck on asigning the events to linking days.

 

help???????????

 

 

here is my code.

 

	<?php 
        // Get values from query string
        $day = $_GET["day"];
        $month = $_GET["month"];
        $year = $_GET["year"];
        $sel = $_GET["sel"];
        $what = $_GET["what"]; 
        
        
        if($day == "")
        $day = date("j");
        
        if($month == "")
        $month = date("m");
        
        if($year == "")
        $year = date("Y"); 
        
        $currentTimeStamp = strtotime("$year-$month-$day");
        $monthName = date("F", $currentTimeStamp);
        $numDays = date("t", $currentTimeStamp);
        $counter = 0;
        $numEventsThisMonth = 0;
        $hasEvent = false;
        $todaysEvents = ""; 
        ?>
        <table width="100%" border='0' cellspacing='0' cellpadding='0'>
          <tr align="center">
            <td width="87" colspan='1' align="center"><input type='button' value='<<' onClick='goLastMonth(<?php echo $month . ", " . $year; ?>)'> 
            </td>
            <td colspan='5' align="center"><span class='title'><?php echo $monthName . " " . $year; ?></span><br>
            </td>
            <td width="87" colspan='1' align='center'><input type='button' value='>>' onClick='goNextMonth(<?php echo $month . ", " . $year; ?>)'>
             </td>
          </tr>
          <tr>
            <td class='style2'>S</td>
            <td width='80' class='style2'>M</td>
            <td width='80' class='style2'>T</td>
            <td width='80' class='style2'>W</td>
            <td width='80' class='style2'>T</td>
            <td width='80' class='style2'>F</td>
            <td class='style2'>S</td>
          </tr>
          <?php
        $numDays = date("t", $currentTimeStamp); 
        for($i = 1; $i < $numDays+1; $i++, $counter++)
        {
        $timeStamp = strtotime("$year-$month-$i");
        if($i == 1)
        {
        // Workout when the first day of the month is
        $firstDay = date("w", $timeStamp);
        
        for($j = 0; $j < $firstDay; $j++, $counter++)
        echo "<td align='center'> </td>"; 
        
        } //end if 
        if(!($db = @ mysql_connect('localhost', 'username', 'password')))
                        {
                            echo 'Error: Could not connect to our database sorry for any inconvience.<br /> Please try at a later time.';
                            exit;
                        }
                        //select which database you want to edit
                        mysql_select_db("edinburg_site");
                        $event_id = $_GET["event_id"]; 
                        
                        
                        if(!isset($event_id))
                                {
                                    $query = "SELECT * FROM calendar order by dateevent asc LIMIT 20";
                                    $result = mysql_query($query);

                                    while($r=mysql_fetch_array($result))
                                    {	
                                   //the format is $variable = $r["nameofmysqlcolumn"];
                                    $event_id=$r["event_id"];
                                    $date=$r["dateevent"];
								$title=$r["title"];

								print $date."<br />";

                                   }
           //prints out all days here...................                     
        if($counter % 7 == 0)
        print "</tr><tr align='center'>"; 
        
        if(date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6)
	print "<td width='50' class='weekend' align='left'>$i</td>";
        else
        if($i == date("d") && $month == date("m") && $year == date("Y"))
        print "<td width='50' class='today' align='left'><div id=\"links\"><a href\"\">$i<span>$title</span></a></div></td>";
        else		
        print "<td width='50' class='normal' align='left'><div id=\"links\"><a href\"\">$i<span>$title</span></a></div></td>";  
	if(isset($date) && $date==$i)
	print "there is an event on today";
                            }//end if///////////////////////////
        }//end of for loop
        ?>
        </table>

Link to comment
Share on other sites

ginger,

 

well its a calendar that should show a pop up floating box with the name of  the event and a link to cal.php page with will give more info to that event.

 

well it works. the calendar works and the floating box that suppose to show the title of the event works as well. i have the calendar db with events and floating box does show the first title of the first event that is in the array $date. so my problem is going through that array and displaying the event in the proper date in the calendar.

 

don't know if i am making sense or not.

 

Link to comment
Share on other sites

Then maybe you should pay someone.

 

wow its been a little over a week since my last post and still no answer. where is the help??????????????????? i need to get this thing done and i am very stuck here.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.