I'm trying to manipulate a PHP script so that it redirects to a particular URL instead of giving me a MySQL error. So I went from this...
$qs = mysql_query("SELECT url FROM $table WHERE `id` = $gid;") or die('MySQL error: '.mysql_error());
...to this:
$qs = mysql_query("SELECT url FROM $table WHERE `id` = $gid;") or header("Location: http://www.example.com");
Which works, but there are two things that concern me. Firstly, it defaults to a 302 redirect, and I would prefer a 301 redirect. Secondly, I'm worried that by removing die() from this line, the script isn't properly exiting after the redirect.
Now, I've done a bit of homework here, but I can't quite figure out if it's possible to combine die() with two instances of header() in that single line of code (i.e. without changing what's around this particular line).