Getting this error: Warning: Cannot modify header information - headers already sent by (output started at /blablabla) in blablabla line 21 require_once("functions.php");. However i need to redirect at that point, the last line of code below is line 21
<?php
require_once("functions.php");
 $username = trim($_POST['username']);
 $password = trim($_POST['password']);
    if ($username&&$password){
    session_start();
     require_once("Connection.php");
      mysqli_select_db($db_server, $db_database) or 
                                                  die("Couldn't find db");
       $username = clean_string($db_server, $username);
       $password = clean_string($db_server, $password);  
       $query = "SELECT * FROM UserDatabase WHERE username='$username'";
        $result = mysqli_query($db_server, $query);
        if($row = mysqli_fetch_array($result)){
        $db_username = $row['username'];
        $db_password = $row['password'];
         if($username==$db_username&&($password)==$db_password){
              $_SESSION['username']=$username;
              $_SESSION['logged']="logged";
              header('Location: Log_homepage.php');
 
     
     
    