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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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