如果条件如何执行3? [关闭]

if (!mail($to,$subject,$body,$headers))
{
    echo "We couldn't sign you up at this time. Please try again later.";
    if(!$email)
    {   
        //register into database
        $register = mysql_query("INSERT INTO `register2`(`username`, `password`, `email`, `code`, `0`, `active`, `First_name`, `Last_name`, `Mobile_number`, `Landline_number`, `sex`) VALUES ('$username', '$password', '$email', '$code', '0', '$active', '$name', '$lname', '$mobile', '$lline', '$sex')");
        $result = mysql_query($register);
        if($result!=0) 
        {
            @session_start(); 
            $_SESSION["email"]=$_POST["email"];
            echo "You have been registered successfully! Please check your email ($email) to activate your account";
            header("location:signup2.php");   
        }
    }
}

how to execute it.means i have this 3 condotion how to execute it and the problem is m not getting inserted data in my phpmyadmin.pls help me....

By the code you've provided, it seems that you want to run your INSERT query if the PHP mail() doesn't fail.

After, you're trying to confirm is the INSERT Query has returned a success flag so you can proceed to the STEP 02.

If my interpretation of your question is correct:

// If the PHP main returns FALSE
if (!mail($to,$subject,$body,$headers)) {
    // user message with error
    echo "We couldn't sign you up at this time. Please try again later.";
}
else {
    //register into database
    $register = mysql_query("INSERT INTO `register2`(`username`,`password`,`email`,`code`,`0`,`active`,`First_name`,`Last_name`,`Mobile_number`,`Landline_number`,`sex`) VALUES ('$username','$password','$email','$code','0','$active','$name','$lname','$mobile','$lline','$sex')");
    $result = mysql_query($register);
}

// if variable $result is TRUE
if ($result) {
    @session_start();
    $_SESSION["email"]=$_POST["email"];
    echo "You have been registered successfully! Please check your email ($email) to activate your account";
    header("location:signup2.php");
}

Some Considerations

  1. Coding style!

    This is just an alert to your code indentation. Analyze the examples provided by php.net Manual to grasp the appropriated code indentation as to allow other to read it well.

    PHP Basic syntax

  2. PHP if, else, elseif/else if or any other control structure

    Being the main issue behind your question, those links should prove useful.

  3. PHP mysql_query() return values:

    For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error. For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.