query($sql); $num = $result->num_rows; $counter = 0; $ready = 0; while ( $counter < $num) { $row = $result->fetch_assoc(); if(($n1 == $row["opinname"]) && ($p1 == $row["oppass"])) { session_start(); $_SESSION['opv_in'] = "YES"; $_SESSION['opv_name'] = $n1; $ready = 1; } else { $counter = $counter + 1; } } if($ready=="1"){ header("Location:opfrontcontrol.php"); } else { header("Location:oplogin.php"); } ?>