php - Extending calendar functionality to accept years -


i'm working on event scheduler site , stuck i'm using months table (with id & month headers) group results month. due this, if try schedule event january 2016, puts month choose intended, understandably puts 2015. i'm looking on extending beyond end of current year , adding functionality different years.

i happily use method using current table setup, tips or suggestions appreciated.

current code follows:

<?php include 'includes/connect.php'; include 'includes/header.php'; $curmonth = date("n"); ?>  <b>upcoming trip information:</b><br><br> <?php  $res = mysql_query("select * months order id"); while ($rows = mysql_fetch_array($res)) { if($rows['id'] >= $curmonth ){  $monthname = $rows['month']; ?> <table cellpadding="0" cellspacing="3" width="100%">  <tr>  <td> <?php  $tid = $_get['transporter']; $check = mysql_query("select * trips monthname(start_date) = '" . $rows['month'] . "' , tid = '$tid'"); $check = mysql_num_rows($check); if ($check < 1) { echo ""; } else { ?> <h2><?php echo $monthname; ?><?php } ?></h2></td></tr> <tr> <?php $cmonth = date('f'); $tid = $_get['transporter']; $res1 = mysql_query("select * trips monthname(start_date) = '$monthname' order start_date"); while ($rows = mysql_fetch_array($res1)) { $trid = $rows['trid']; $trip_start = $rows['trip_start']; $trip_end = $rows['trip_end']; $start_date = $rows['start_date']; $end_date = $rows['end_date']; $colour = $rows['colour']; $stime = strtotime($start_date); $startt = date("l js", $stime); $etime = strtotime($end_date); $endt = date("l js", $etime); ?>  <td valign="middle" style="height: 100px; background-color: #4b99ed; text-align: center;">  <div style="font-size: 17px; color: #ffffff;"><?php echo $trip_start; ?> <?php echo $trip_end; ?></div>  <div style="font-size: 15px; color: #ffffff;"><?php echo $startt; ?> - <?php echo $endt; ?></div>   </td>  <?php } } } ?>  </tr>  </table> <?php include 'includes/footer.php'; ?> 

if possible maintain results layout..

enter image description here

you try, instead of using months table, using start_date column of trips table.

try changing query:

select trips.*, date_format('%m, %y', start_date) `dt`  trips   tid = '$tid' /* bad, please prepare or escape variables*/  order `dt` asc 

you won't have first query months , loop through them. if must have empty containers each month, try using query, loop through php-generated array of months display.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -