Page 1 of 1

Multiple Querys not Processing...

Posted: Wed Jul 19, 2006 8:15 am
by tecktalkcm0391
I have the following code and I only get to checkpoint 1...

Code: Select all

//  Queries
    $query1 = mysql_query("INSERT INTO auth (Username) VALUES ('$username')"); 
    sleep(2);
    // ___________
    // ___________
    print ("Checkpoint 1");
    // ___________
    // ___________


    if(!$query1)
    {
         return "An error has occurred." . mysql_error();
    } else {
         $query2 = mysql_query("SELECT ID FROM auth WHERE Username = '{$username}' ");
    }
    $id = mysql_fetch_array($query2);
    $id = $id['userID']; 
    // ___________
    // ___________
    print ("Checkpoint 2");
    // ___________
    // ___________
    if(!$query2)
    {
         return "An error has occurred." . mysql_error();
    } else {
         $query3 = mysql_query("INSERT INTO pass (ID, Password) VALUES ('$id','$password')");
    }
    // ___________
    // ___________
    print ("Checkpoint 3");
    // ___________
    // ___________
    if(!$query3)
    {
         return "An error has occurred." . mysql_error();

    } else {
        $query4 = mysql_query("INSERT INTO secur (ID, SecurityQuestion, SecurityAnwser) VALUES ('$id', '$firstname', '$sq', '$sa')");    
    }    
    
    if(!$query4)
    {
        return "An error has occurred." . mysql_error();
    } else {
        $query5 = mysql_query("INSERT INTO info (ID, FirstName, LastName, Address1, Address2, City, State,  Zip, Country, Telephone, DOBMonth, DOBDay, DOBYear, Gender) VALUES ('$id', '$firstname', '$lastname', '$address1', '$address2', 'city', '$state', '$zip', '$country', '$telephone', '$dob_m', '$dob_d', '$dob_y', '$gender')");        
    }
    if(!$query5)
    {
        return "An error has occurred." . mysql_error();
    } else {
        require("register/page5.php"); 
        session_destroy();
    }

Posted: Wed Jul 19, 2006 10:36 am
by tecktalkcm0391
Is query1 the right way to do that?

Posted: Wed Jul 19, 2006 10:39 am
by Burrito
`userUsername` or just `Username`

8O

Posted: Wed Jul 19, 2006 6:17 pm
by tecktalkcm0391
yeah I fixed that and I still get the same thing...

Posted: Wed Jul 19, 2006 6:20 pm
by Burrito
add some error reporting you should:

Code: Select all

mysql_query(...)
   or die(mysql_error());
lead you in the right direction that might.