0) { $_SESSION['msg'] = "Your mobile number is already registered with Treatpay, Please login or contact website administrator."; } else { $sql1 = "select * from registrations where mobile = '".$mobile."' order by id desc limit 1"; $result1 = mysqli_query($con, $sql1); if (mysqli_num_rows($result1) > 0) { $row = mysqli_fetch_assoc($result1); $stage = $row['stage']; $rid = $row['id']; //if($stage == '1') //{ header("location:reg-02.php?rid=" . $rid); //} } else { $sql = "insert into registrations(mobile, stage) values('".$mobile."', 1)"; $result = mysqli_query($con, $sql); if($result) { $_SESSION['msg'] = "You registration request placed successfully, proceed by providing basic details."; $sql1 = "select * from registrations where mobile = '".$mobile."' order by id desc limit 1"; $result1 = mysqli_query($con, $sql1); if (mysqli_num_rows($result1) > 0) { $row = mysqli_fetch_assoc($result1); $rid = $row['id']; header("location:reg-02.php?rid=" . $rid); } } } } } ?>