Yesterday my journal site was working fine - then today I get this error message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site168/fst/var/www/html/index.php on line 171
Here is the code:
<?
if ((!$day || !$year || $month) && !$mydate) {
$mydate = date("Y-m-d");
} else {
$month = $month+1;
if ($year && $month && $day) {
$mydate = "$year-$month-$day";
}
}
echo "<strong style='font-size: 13px;color:#666699;'>$mydate</strong><br /><br />";
echo "<input type=\"hidden\" name=\"mode\" value=\"gowrite\">";
echo "<input type=\"hidden\" name=\"mydate\" value=\"$mydate\">";
$sql = "select * from notes where notes_date='$mydate' order by notes_time desc";
$result = mysql_query($sql);
while ($row=mysql_fetch_array($result)) {
echo "
<strong style='font-size: 11px;'>$row[notes_user]</strong> $row[notes_time]
<br>--------------------------------------------------------------------------------------
<br/>".nl2br(stripslashes($row[notes_note]))."<br /><br />
";
}
mysql_free_result($result);
if ($mynotes && $user) {
if ($allowhtml == "0") {
$mynotes = str_replace("<", "<", "$mynotes");
$mynotes = str_replace(">", ">", "$mynotes");
}
if ($mydate && $todayonly == "0") {
$sql = "insert into notes (notes_date,notes_note,notes_time,notes_user) values ('$mydate','$mynotes',CURTIME(),'$user')";
} else {
$mydate = date("Y-m-d");
$sql = "insert into notes (notes_date,notes_note,notes_time,notes_user) values ('$mydate','$mynotes',CURTIME(),'$user')";
}
mysql_query($sql) or die("error 324343");
$adate = explode("-", $mydate);
$mymonth = $adate[1]-1;
header("Refresh:0;url=$PHP_SELF?day=$adate[2]&month=$mymonth&year=$adate[0]");
}
if ($todayonly == "1") {
$posttext = "<strong style='font-size: 10px;color:#666699;'>Note: You can only post under today's date</strong>";
} else {
$posttext = "<strong style='font-size: 10px;color:#666699;'>Note: You can post notes under any date, past, present or future</strong>";
}
?>