Problem with Header()
| From: | Jay | Date: | Thu, 10 Aug 2000 16:25:40 +0000 |
| Subject: | Problem with Header() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11174@lists.php.net to get a copy of this message | ||
Thanks to all of those who have helped so far,
I get still get this error:
Warning: 0 is not a MySQL result index in (absolute path)/html.php3 on line
17
Whenever someone accesses html.php3 alone, and not with html.php3?id=#
All I want it to do is to check if it's empty and then redirect. Here is my
code:
<html>
<?
$server="localhost";
$username="username";
$password="pass";
$database="database";
$table="table";
@mysql_connect($server, $username, $password) or die("Connection");
@mysql_select_db($database) or die("Database");
?>
<?
$Result=@mysql_query("SELECT * FROM $table WHERE id=$id");
while($row = @mysql_fetch_array($Result))
if ($id) {
header("Location: http://www.domain.com/");
exit;
} else {
$title = $row["title"];
echo "<head>
<title>$title</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type='text/css'>
<!--
FORM { margin: 0px 0px}
-->
</style>
</head>";
}
?>
Thanks again,
Jay Stauffer