query($sql); $num = $result->num_rows; $counter = 0; $ready = 0; while ( $counter < $num) { $row = $result->fetch_assoc(); if(($n1 == $row["genin"]) && ($p1 == $row["genpass"])) { session_start(); $_SESSION['gen_in'] = "YES"; $_SESSION['gen_name'] = $n1; $ready = 1; } else { $counter = $counter + 1; } } if($ready=="1"){ header("Location:setupgenticket.php"); } else { header("Location:genlogin.php"); } ?>