$check1 = mysqli_query($conn, "select * from Sailors where Name='$habboname'");
$check2 = mysqli_query($conn, "select * from Sailors where Position='$position'");
$num_rows = mysqli_num_rows($check1);
$num_rows2 = mysqli_num_rows($check2);
if ($num_rows > 0) {
echo "This user (<b>" . $habboname . "</b>) is already in our database.";
exit();
} else {
if ($num_row2 = 0){
$sql = "INSERT INTO Sailors (ID, Name, Joined, Rank, Billet, Position, Status, Promoter, Reason, Promo_Date)
VALUES ('', '$habboname', '$date', '$rank', '$billet', '$position', 'Active', '$promoter', '$reason', '$date')";
if ($conn->query($sql) === TRUE) {
header("Location: useradded.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
} else {
echo $num_row2;
}
It will always echo, even if the variable IS 0. I am really confused. If you know what the issue is, please let me know. Thanks :)