Click here to Skip to main content
11,927,440 members (46,299 online)
Rate this:
Please Sign up or sign in to vote.
See more: HTML PHP Ajax jQuery
Hi All,

I need your help. I want to build a calendar agenda. I've found a script and modified for include database function.
This is calendar.php
include "connection.php";

After doing some review, I've got a problem. When user A insert new agenda, user B must refresh it manually to see the changes. So I'm using auto refresh div ajax and split the code above into two parts. The first is for calendar and the second is for database. But there's some error with the date doesn't show properly.
Here's the calendar code after divided into two parts.
include "file_koneksi.php";

And here's the database code
include "file_koneksi.php";
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) 
	//echo "($maxday+$startday)";	
	//echo "<a href=2.php>".$i."</a><br>";
	if(($i % 7) == 0 ) 
		echo "";
	if($i < $startday) 
		echo "<td></td>\n";
		$sql = "select * from data_agenda where tgl_agenda='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'";
		$hs = mysql_query($sql);
		$jmlAcara = mysql_num_rows($hs);
		echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">";
		echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])."  önclick=\",'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>";
		echo "</td>\n";
		//echo "$cMonth";

Am I wrong on divided the first script or in put div id ?

Thank you..

Posted 21-Jan-13 21:22pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100