son Posted July 11, 2009 Share Posted July 11, 2009 I have a calendar script that displays entered activities for the relevant time on a relevant day. Now I allowed on input form to enter a starting time and end time on same day for any new activity. I just cannot get my head around how I repeat from row of start time to row of end time the given activity in day calendar. My code is: // output table headerob_start();echo '<table id="day_calendar">';echo '<tr id="day_calendar_header"><th colspan="2">';echo '<a href="'. htmlspecialchars($_SERVER['PHP_SELF']) . '?t=' . strtotime('-1 day', $timestamp) . '"><</a> '; $x = date('l, d. F Y', $timestamp);$x = str_replace(array_keys($day_names),array_values($day_names),$x);$x = str_replace(array_keys($month_names),array_values($month_names),$x);echo $x;echo ' <a href="'. htmlspecialchars($_SERVER['PHP_SELF']) . '?t=' . strtotime('+1 day', $timestamp) . '">></a>';echo '</th></tr>';// output cellsfor ($i = DAY_HR_START; $i <= DAY_HR_END; $i++){ for ($j = 0; $j < 60; $j += 30) { echo '<tr>'; printf('<td class="time">%d:%02d</td>', $i, $j); echo '<td class="event">'; $query = sprintf('SELECT EVENT_NAME, CONFIRM FROM %scalendar WHERE ' . 'EVENT_TSTAMP = "%04d-%02d-%02d %02d:%02d:00"', DB_TBL_PREFIX, $year, $month, $day, $i, $j); $result = mysql_query($query, $GLOBALS['DB']); if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { if ($row['CONFIRM'] == '0' ) { echo '<div class="confirmNo">' . htmlspecialchars($row['EVENT_NAME']) . '</div>'; } else { echo '<div class="confirmYes">' . htmlspecialchars($row['EVENT_NAME']) . '</div>'; } } } else { echo ' '; } mysql_free_result($result); echo '</td>'; echo '</tr>'; }}echo '</table>'; Any ideas?Son Link to comment Share on other sites More sharing options...
son Posted July 11, 2009 Author Share Posted July 11, 2009 Just solved it. All working now:-)Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.