rockindano30 Posted April 25, 2008 Share Posted April 25, 2008 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 https://forums.phpfreaks.com/topic/102927-event-calendar-help/ Share on other sites More sharing options...
GingerRobot Posted April 25, 2008 Share Posted April 25, 2008 How about narrowing down the problem a bit? What does the above code do? What doesn't it do? Are there any errors? If so, where do they come from? Which bit of it do you need help with? Link to comment https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-527237 Share on other sites More sharing options...
rockindano30 Posted April 25, 2008 Author Share Posted April 25, 2008 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 https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-527250 Share on other sites More sharing options...
rockindano30 Posted April 30, 2008 Author Share Posted April 30, 2008 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 https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-530561 Share on other sites More sharing options...
jonsjava Posted April 30, 2008 Share Posted April 30, 2008 MODERATOR: Double post. Link to comment https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-530565 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 1) You haven't tried anything on your own for a week? Shame on you. We're here to help, not do it for you. 2) What's the actual problem with it? >_> Link to comment https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-530566 Share on other sites More sharing options...
revraz Posted April 30, 2008 Share Posted April 30, 2008 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 https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-530601 Share on other sites More sharing options...
rockindano30 Posted May 2, 2008 Author Share Posted May 2, 2008 i have been working for a week on other projects though. you know i have more than one to work on. lol problem is i can't seem to retrieve my events from my db. i know i'm missing a for loop or something. Link to comment https://forums.phpfreaks.com/topic/102927-event-calendar-help/#findComment-531831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.