0

i have a problem of below code on php :(

<?php echo $_GET["u"]; 
$servername = "localhost";
$username = "******";
$password = "*****?";
$dbname = "*****";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$tt=$_GET["u"];
$sql = "SELECT url from code WHERE BINARY short="."'$tt'";
$result=$conn->query($sql);
$data=$result->fetch_assoc();
$url="Location: ".$data["url"];
header($url); /* Redirect browser */
exit();
?>

my problem on this line :(

 header($url); /* Redirect browser */

$url variable is a link a get from database.!

1 Answers1

1

Well, it's not lying. You have echo $_GET["u"]; at the top of your script.

There must be NO OUTPUT AT ALL before sending headers.

rjdown
  • 9,162
  • 3
  • 32
  • 45