-1

hey all i have this code, the query works totally fine but the header no please help , this is my code i appreciate it

<?php

 if (isset($_POST['login'])){

$username=$_POST['username'];
$pass=$_POST['password'];
$hashedpass=md5($pass);

$query="SELECT username, password FROM users WHERE username='$username' AND password='$hashedpass'";
echo $query;
$run=mysqli_query($con, $query);

$rows=mysqli_num_rows($run);

if ($rows > 0){
    $_SESSION['username'] = $username;
    header('Location: index.php');
    exit();
  }

}


?>
Username Password
Farzin Kanzi
  • 3,380
  • 2
  • 21
  • 23
eddy10394
  • 37
  • 4
  • Possible duplicate of [header location not working in my php code](http://stackoverflow.com/questions/12525251/header-location-not-working-in-my-php-code) – David Rawson Feb 03 '17 at 23:08

1 Answers1

0

Try writing complete uri and delete exit header('Location: http://www.domain/index.php');

Fran Cerezo
  • 940
  • 3
  • 8
  • 19