Re: Problem with Header()
| From: | Matt McClanahan | Date: | Thu, 10 Aug 2000 16:48:27 +0000 |
| Subject: | Re: Problem with Header() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11181@lists.php.net to get a copy of this message | ||
On Thu, 10 Aug 2000, Dave Daniels wrote:
> You've almost got it. First, I'd check the $id variable using isset(), then
> run the query if it doesn't exist. No need to run it otherwise.
>
> if (isset($id)) {
> header("Location: http://www.domain.com/");
> exit;
>
> } else {
> $Result=@mysql_query("SELECT * FROM $table WHERE id=$id");
> while($row = @mysql_fetch_array($Result))
Other way around. ;)
if( !isset($id) )
{
Header('Location: http://www.domain.com/');
exit; // This hardly seems necessary, now that I think about it
}
else
{
// Query that depends on $id being set
}
Matt