Multiple Querys not Processing...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Multiple Querys not Processing...

Post 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();
    }
Last edited by tecktalkcm0391 on Wed Jul 19, 2006 6:21 pm, edited 1 time in total.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Is query1 the right way to do that?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

`userUsername` or just `Username`

8O
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

yeah I fixed that and I still get the same thing...
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
Post Reply