Clinton Posted January 1, 2009 Share Posted January 1, 2009 What's wrong with the code below? It's not inserting into the second query. (If possible can I just combine the two into one statement?) if (empty($errors)) { $a = md5(uniqid(rand(), true)); $query = "INSERT INTO users (username, password, active) VALUES ('$username', SHA('$password'), '$a')"; $result = @mysql_query($query); $query2 = "INSERT INTO employers (username, fname, lname, title, prefix, cname, caddress, ccity, cstate, czip, cinfo, clogo, firstpnumber, secondpnumber, website, email, signuprate) VALUES ('$username', '$fname', '$lname', '$title', '$prefix', '$cname', '$caddress', '$ccity', '$cstate', '$czip', '$cinfo', '$clogo', '$pphone', '$sphone', '$cwebaddy', '$email', '$crate' )"; $result2 = @mysql_query($query2); Quote Link to comment Share on other sites More sharing options...
Clinton Posted January 1, 2009 Author Share Posted January 1, 2009 extract($_POST); I was inserting the variables without the _POST so I just extracted it. :-p Quote Link to comment Share on other sites More sharing options...
revraz Posted January 1, 2009 Share Posted January 1, 2009 use mysql_error() after the query and see what error it's giving. If any of your field names are unique (username maybe?), then your insert will error. Why don't you just combine them? Quote Link to comment Share on other sites More sharing options...
Clinton Posted January 1, 2009 Author Share Posted January 1, 2009 Cause I don't know how to (combine them). Quote Link to comment Share on other sites More sharing options...
revraz Posted January 1, 2009 Share Posted January 1, 2009 Copy the field names and values in the first one and put them in the second one? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.