Jump to content

Need some formatting help on a calendar. Probably a simple job.


kb9yjg

Recommended Posts

Hello everyone, I have a script I have been working on to create a weekly event calendar. What I need done is placing the two links at the proper positions i.e. date and time. I also need logic to figure out what else is blank and fill in with nbsp's as well as an ending </tr> that is until more events get added.

What its not doing is populating the link in the right box for date and time, not providing remaining cells as nbsp. Check out http://bitsonline.vndv.com/index.php for a demo.  I will have the file below as well. Your assistance is greatly appreciated.

 

<?
include('inc/connect.inc');
$table="events";
$q="select * from $table";
$res=mysql_query($q) or die("Error selecting events. ".mysql_error());
$stime = strtotime('12am'); 
for ($i = 0; $i < (24 * 4); $i++) { 
    $tod = $stime + ($i * 30 * 60); 
    $display = date('h:i A', $tod); 
    if (substr($display, 0, 2) == '00') { 
        $display = '12' . substr($display, 2); 
    } 
echo '<tr><td scope=row align=center>'.$display.'</td>';
while($row=mysql_fetch_assoc($res)){
if(empty($row['event'])){echo '<td> </td>';}
echo '<td align="center"><a title="'.$row['eday'].'<br />'.$row['evtime'].'<br />'.$row['about'].'">'.$row['event'].'</a></td>';
}

}
echo "</tr>";
?>

 

the above code prints out time in incriments of .5 hours then connects to the db and tries to retrieve the data upon which it is getting echoed in the first two squares as opposed to proper dates and times.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.