Hi I am having trouble with this code:
<?
$host="mysql6.000webhost.com"; // Host name
$username="removed"; // Mysql username
$password="removed"; // Mysql password
$db_name="removed"; // Database name
$tbl_name="direct"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Error. MySQL Not Responding.");
$SQL = "SELECT * FROM $tbl_name";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$url = $db_field['url'];
}
//Banned st00f...
include('/home/a1092592/public_html/ban/banned.php');
//redirect....
header("location:$url");
?>
This code is not working properly. I have a MySQL Database that holds the URL in the $url variable. It pulls it straight off the table. But it returns a 404 error, even though the URL is alive. I tried google.com, and it errored out with a 404. But, I tried storing the URL in a string, and it worked. But I want it to work with the MySQL Database.