4 Replies - 5453 Views - Last Post: 12 May 2012 - 08:34 AM Rate Topic: -----

#1 fatt89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-May 12

Add event calendar

Posted 12 May 2012 - 05:56 AM

<?php
	$days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
echo "<table border=\"1\" cellpadding=\"5\"><tr>\n";
	foreach ($days as $day) {
	    echo "<td style=\"background-color: #CCCCCC; text-align: center; width: 14%\">
          <strong>$day</strong></td>\n";
	}
 
for ($count=0; $count < (6*7); $count++) {
	    $dayArray = getdate($start);
	    if (($count % 7) == 0) {
	        if ($dayArray["mon"] != $month) {
	            break;
	        } else {
	            echo "</tr><tr>\n";
	        }
	    }
	    if ($count < $firstDayArray["wday"] || $dayArray["mon"] != $month) {
	        echo "<td> </td>\n";
	    } else {
        $chkEvent_sql = "SELECT event_title FROM calendar_event WHERE month(event_start) = '".$month."' AND dayofmonth(event_start) = '".$dayArray["mday"]."' AND year(event_start) = '".$year."' ORDER BY event_start";
	        $chkEvent_res = mysql_query($chkEvent_sql, $mysql) or die(mysql_error($mysql));
	 
	        if (mysql_num_rows($chkEvent_res) > 0) {
	            $event_title = "<br/>";
	            while ($ev = mysql_fetch_array($chkEvent_res)) {
	                $event_title .= stripslashes($ev["event_title"])."<br/>";	            }
           mysql_free_result($chkEvent_res);
        } else {
	            $event_title = "";
	        }
	 
	        echo "<td valign=\"top\"><a href=\"java script:eventWindow('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";
	 
	        unset($event_title);
	 
	        $start += ADAY;
	    }
	}
	echo "</tr></table>";
	mysql_close($mysql);
	?>

This post has been edited by Dormilich: 12 May 2012 - 06:33 AM
Reason for edit:: please use [code] [/code] tags when posting code


Is This A Good Question/Topic? 0
  • +

Replies To: Add event calendar

#2 fatt89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-May 12

Re: Add event calendar

Posted 12 May 2012 - 06:01 AM

i doing my Final year project currently. i need to make out an event calendar in my e-learning system. i have tried a lots example. but fail to do make it. finally i found this source. it is a good source. but this line

echo "<td valign=\"top\"><a href=\"java script:eventWindow('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n";


show a message with

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

anyone have an idea to solve my problem??

This post has been edited by Dormilich: 12 May 2012 - 06:29 AM
Reason for edit:: please use [code] [/code] tags when posting code

Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3555
  • View blog
  • Posts: 10,335
  • Joined: 08-June 10

Re: Add event calendar

Posted 12 May 2012 - 06:32 AM

change the permissions of event.php or the resources used therein.

I donít know if the script in post #1 is event.php, but as it stands there, it wonít work anyways.
Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3034
  • Posts: 10,598
  • Joined: 08-August 08

Re: Add event calendar

Posted 12 May 2012 - 06:34 AM

I'm wondering how you got to your final year without learning about objects, or functions, or separation of concerns. Or even learning to avoid magic numbers!

Quote

finally i found this source. it is a good source. but this line

Worst of all, what makes you think copying some one else's code is how you should be writing your own?
Was This Post Helpful? 0
  • +
  • -

#5 Slice  Icon User is offline

  • sudo pacman -S moneyz


Reputation: 245
  • View blog
  • Posts: 719
  • Joined: 24-November 08

Re: Add event calendar

Posted 12 May 2012 - 08:34 AM

A final year project will be looked at for signs of plagiarism. At my University, plagiarism will get you kicked out, with no qualifications and a heap of student debts.

Don't know what it's like at your school/college/uni, but either way, it isn't worth it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1