0) if (!mysql_query("INSERT Comments SET y=".$y.", m=".$m.", d=".$d.", c='".$c."'")) return header('HTTP/1.0 500 '.mysql_error()); return; } $u = isset($_GET['u']) ? $_GET['u'] : $_SERVER['PHP_AUTH_USER']; if (!mysql_query("DELETE FROM Data WHERE y=".$y." AND m=".$m." AND d=".$d." AND u='".$u."'")) return header('HTTP/1.0 500 '.mysql_error()); if (mysql_affected_rows()==0) { if (!mysql_query("INSERT Data SET y=".$y.", m=".$m.", d=".$d.", u='".$u."'")) return header('HTTP/1.0 500 '.mysql_error()); } } $query = "SELECT d, u FROM Data WHERE y=".$y." AND m=".$m; if (isset($_GET['d'])) $query .= " AND d=".$_GET['d']; $result = mysql_query($query); if (!$result) return header('HTTP/1.0 500 '.mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_NUM)) print($row[0]."\t".$row[1]."\n"); ?>