Beauford Posted August 21, 2007 Share Posted August 21, 2007 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> </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> </td>\n"; } } $i++; } echo "</tr>\n"; } EDITED BY akitchin: be kind and use code tags, please. Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/ Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2007 Share Posted August 21, 2007 "The following code is where it seems to fail, but who knows, it could be somewhere else in the code." Dude! That's not very specific at all. Have you tried putting in echo statements to watch the values as the code runs? Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330326 Share on other sites More sharing options...
Beauford Posted August 21, 2007 Author Share Posted August 21, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330343 Share on other sites More sharing options...
akitchin Posted August 21, 2007 Share Posted August 21, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330349 Share on other sites More sharing options...
Beauford Posted August 21, 2007 Author Share Posted August 21, 2007 Solved. That was the problem. I just added padded the field so it is 00. This value comes from a previous 'for' statement. i.e. for $i = 0....... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330358 Share on other sites More sharing options...
akitchin Posted August 21, 2007 Share Posted August 21, 2007 please hit the topic solved button. Quote Link to comment https://forums.phpfreaks.com/topic/66047-calendar-problem/#findComment-330368 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.