Hi!
I have a script which shows all records, and a calendar which displays records for that date. When a record is created, the record shows up in the correct place in the calendar. But when I alter the date, it no longer shows up in the calendar. I see that the date changes, so I know that part of it works correctly. The error seems to be on the page that displays the records when I click the date in the calendar. the calendar compares $cal_string to $date_string and if they match, displays the records. I echo both variables, I get some matches for the date, but the variables do not match! $cal_string displays a date correctly, but $date_string displays a 3 digit number. I'm not sure why some records are displayed correctly but others do not, and do not understand why the two variables do not match.
Any help or direction would be greatly appreciated.
<html>
<head>
<title>I-DEP - Depositions by Date</title>
</head>
<body>
<?php
// Connect to database
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$Day = $_GET['Day'];
$Year = $_GET['Year'];
$Month = $_GET['Month'];
$cal_string = date("Y-m-d", strtotime("$Month $Day $Year"));
$sqlquery = "SELECT id, diwtitle, date_string FROM diw_alpha WHERE date_string = '$cal_string'";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$row = mysql_fetch_row($queryresult);
$date_string = $row[0];
$diwtitle = $row[1];
$id = $row[2];
$tdcount = 1;
$numtd = 1; // number of cells per row
//echo $date_string;
//echo $cal_string;
echo '
<TABLE border="0">
<TR>
<TD> Date </TD>
<TD> Title </TD>
<TD> ID </TD>';
while($row = mysql_fetch_array($queryresult)) {
if ($tdcount == 1) echo "<tr>";
echo '<td>'.$row['date_string'].'</td><td><a href="damndiw4.php?id='.$row['id'].'"> '.$row['diwtitle'],'</a></td><td>'.$row['id'].'</td>';
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
// close up table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>