for ($j = 0 ; $j < $rows ; ++$j)
{
$result->data_seek($j);
$row = $result->fetch_array(MYSQLI_ASSOC);
if($name==$row['имя'] && $surname==$row['фамилия'] && $password==$row['пароль'])
{
$id=$row['id'];
setcookie("TestCookie", $id, time()+3600);
echo "<script>document.location.href='../hiPage/hiPage.php'</script>";
}
}