Pooya Soleimani Pooya Soleimani - 6 months ago 14
PHP Question

headers already sent by php ERROR :|

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);
$sql = "SELECT url from code WHERE BINARY short="."'$tt'";
$url="Location: ".$data["url"];
header($url); /* Redirect browser */

my problem on this line :(

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

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


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.