title: Why i can't redirect browser to index.php page if 'id' not existed?
body: <p>I'm trying to redirect the query with not existing ID to main page but always get errors caused by entries like </p>
  
  <pre><code>"&lt;?php echo $row['script']; ?&gt;" 
  </code></pre>
  
  <p>if i did't even check for '$result': 
  "Undefined variable: row in C:\www\sts3\page.php on line 37..."</p>
  
  <pre><code>require_once("php/db_connect.php"); 
  if(isset($_GET['id'])) {
    if( $_GET['id'] == '' || !is_numeric($_GET['id']) )  {
      $id = 1;
    }
    else {
      $id = mysqli_real_escape_string($connection, $_GET['id']);
      $query = "SELECT * FROM content WHERE ID = '" . $id . "'";
      $result = mysqli_query($connection, $query);
      if (empty($result)) {
        header("Location:index.php"); // NOT WORKING HERE
        die();
      }
      $row = mysqli_fetch_assoc($result);
    }
  }
  </code></pre>