I'm working with a calendar script, which more or less builds itself based on the server date. I'm having trouble placing the cell with day one on the right day of the week. The code is here:
<?php
$d = date();/* here is where I need help deciding what day of the week the 1st is, then placing the following inside a loop to make sure day one is on the first day of the week*/
for ($f = 0; $f == $d; $d++)
{
echo("<td width=\"120\" height=\"100\" valign=\"top\"></td>");
}
$i = 1;
while($row = mysql_fetch_array($result))
{ ?>
<td width="120" height="100" valign="top"><p><?php echo $i; ?></p>
<p align="center"><font size="2">
<?php echo $row['event']; ?></font></p>
<?php
$i++;
$d++;
if ( $d > 7)
{
$d = 1;
echo "</tr><tr>";
}
?>
Any ideas?
~JOSH