I have this code that I have made and have been trying to fix it for days. I am trying to make it redirect to whatever the $link variable is set to. All it does is just give me a blank page. Any answers?
<?php
$l = $_GET['l'];
$db = new mysqli('localhost', 'root', 'password', 'link');
$sql = "SELECT * FROM links WHERE new_url='$l'";
$result = $db->query($sql);
if($result->num_rows > 0) {
$row = $result->fetch_assoc();
$link = $row['website'];
$string = $row['new_url'];
echo '<script type="text/javascript">',
'window.location = $link;',
'</script>';
} else {
@include('./error.php');
}
?>