Hello!
I'm currently learning how to write PHP script for displaying On Day Like Today events.
Everything works fine except when we are first of the month the usage of:
$eday = $today[mday]-1;
is simply not useful. Does anybody have any idea how to avoid this problem. I need to display the events for today, yesterday and tomorrow date.
Here is the portion of the script that displays yesterday’s events:
<?php
include("config.php");
mysql_connect($dbhost, $dbuname, $dbpass);
@mysql_select_db("$dbname") or die ("Unable to select database");
$today = getdate();
$eday = $today[mday]-1;
$emonth = $today[mon];
$result = mysql_query("select yid, dogodki from $prefix"._ephem." where did='$eday' AND mid='$emonth'");
while(list($yid, $content) = mysql_fetch_array($result)) {
if ($cnt==1) {
echo "<br>";
}
echo "<b>$yid</b></b> - $content";
$cnt = 1;
}
?>
Thnx, Dean.