Jump to content

Recommended Posts

I have a Windows test machine I use to code in, and then it gets ported over to a Linux machine. I downloaded and modified an event calendar and have it working perfectly in Windows (PHP Version 5.1.5, MySQL 5), but not in Linux (PHP Version 4.4.4, MySQL 4).

 

The following code is where it seems to fail, but who knows, it could be somewhere else in the code. If there is an event in the database for any days in the month it is supposed to create a link on the calendar, it is not doing this.

 

Any help is appreciated. I can post the entire code if need be, it's only 180 line.

 

Thanks

 

$query = "select eventdate from calendar;";
$result = mysql_query ($query)  or $mysqlerror = mysql_error();

while ($line = @mysql_fetch_array($result, MYSQL_ASSOC)) {
$dbeventdate[] = $line['eventdate']; 
}

$i = 0; 
foreach($weeks AS $week){ 
       echo "<tr>\n"; 
       foreach($week as $d){ 
         if($i < $offset_count){ 
		 echo "<td>&nbsp</td>\n";

         } 
         if(($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)){ 
		 if(in_array("$year-$month-$d", $dbeventdate)) {
			 $day_link  = "<a href=\"javascript:loadintoIframe('events', 'eventdata.php?showevent=$year-$month-$d')\" id='linked'>$d</a>";
			 echo "<td><b>$day_link</b></td>\n"; 
		 }
		 else {
             $day_link = "$d"; 
			 echo "<td><b>$day_link</b></td>\n"; 
		}
         } 
	 elseif(($outset > 0)) { 
            if(($i >= ($num_weeks * 7) - $outset)){ 
               echo "<td>&nbsp</td>\n"; 
            } 
         } 
         $i++; 
      } 
      echo "</tr>\n";    
} 

 

EDITED BY akitchin:  be kind and use code tags, please.

Link to comment
https://forums.phpfreaks.com/topic/66047-calendar-problem/
Share on other sites

Dude!  As I suspect the problem is with the code I supplied I was quite specific as to what the problem is and where it might be. I also mentioned I would post the rest of the code if necessary.

 

I have put in echo statements which solve nothing as there is nothing to show.

 

Another question thought to try and narrow this down. In the database the date is shown as 0000-00-00 and the date I am comparing it to is 0000-00-0. Is this going to make a difference in Linux - In Windows it doesn't seem to matter.

 

Link to comment
https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330343
Share on other sites

it should matter regardless of where you're running the code.  0000-00-0 shouldn't ever match 0000-00-00 unless the difference in MySQL versions means that one is more lenient than the other (turning your 0000-00-0 into 0000-00-00 automatically when comparing).  why are you using 0000-00-0?

Link to comment
https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330349
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.