liamjw Posted August 11, 2009 Share Posted August 11, 2009 Hi, I have created a multi page form using sessions but cannot seem to post the final data in to an SQL database, can anyone look at my code below and offer any help. <?php //let's create the query mysql_connect ("BLAN","BLANK","BLANK"); mysql_select_db("BLANK"); $insert_query = ("insert into subscriptions ( title, forename, surname, tel, mob, fax, e_mail, e_mail2, address1, address2, address3, city, county, post_code, county, baddress1, baddress2, baddress3, baddress4, bcity, bcounty, bpost_code, bcountry, nameOnCard, card_type, card_number, exp_month, exp_year, card_verification_no, start_month, start_year, issue_no" ). "VALUES ( " . $_SESSION['title'] . ", " . $_SESSION['forename'] . ", " . $_SESSION['surname'] . ", " . $_SESSION['tel'] . ", " . $_SESSION['mob'] . ", " . $_SESSION['fax'] . ", " . $_SESSION['e_mail'] . ", " . $_SESSION['e_mail2'] . ", " . $_SESSION['address1'] . ", " . $_SESSION['address2'] . ", " . $_SESSION['address3'] . ", " . $_SESSION['city'] . ", " . $_SESSION['county'] . ", " . $_SESSION['post_code'] . ", " . $_SESSION['country'] . ", " . $_POST['baddress1'] . ", " . $_POST['baddress2'] . ", " . $_POST['baddress3'] . ", " . $_POST['baddress4'] . ", " . $_POST['bcity'] . ", " . $_POST['bcounty'] . ", " . $_POST['bpost_code'] . ", " . $_POST['bcountry'] . ", " . $_POST['nameOnCard'] . ", " . $_POST['card_type'] . ", " . $_POST['card_number'] . ", " . $_POST['exp_month'] . ", " . $_POST['exp_year'] . ", " . $_POST['card_verification_no'] . ", " . $_POST['start_month'] . ", " . $_POST['start_year'] . ", " . $_POST['issue_no'] . " )"); mysql_query($insert_query); ?> Thanks for any help that can be offered Quote Link to comment Share on other sites More sharing options...
Bjom Posted August 11, 2009 Share Posted August 11, 2009 use [ php] [ /php] tags around the code, pls. makes it easier to read - and to find errors. It's then easy to see that the parentheses ) closing the field list - is outside the quotes.... always echo your queries and test them... <?php //let's create the query mysql_connect ("BLAN","BLANK","BLANK"); mysql_select_db("BLANK"); $insert_query = ("insert into subscriptions ( title, forename, surname, tel, mob, fax, e_mail, e_mail2, address1, address2, address3, city, county, post_code, county, baddress1, baddress2, baddress3, baddress4, bcity, bcounty, bpost_code, bcountry, nameOnCard, card_type, card_number, exp_month, exp_year, card_verification_no, start_month, start_year, issue_no" ). "VALUES ( " . $_SESSION['title'] . ", " . $_SESSION['forename'] . ", " . $_SESSION['surname'] . ", " . $_SESSION['tel'] . ", " . $_SESSION['mob'] . ", " . $_SESSION['fax'] . ", " . $_SESSION['e_mail'] . ", " . $_SESSION['e_mail2'] . ", " . $_SESSION['address1'] . ", " . $_SESSION['address2'] . ", " . $_SESSION['address3'] . ", " . $_SESSION['city'] . ", " . $_SESSION['county'] . ", " . $_SESSION['post_code'] . ", " . $_SESSION['country'] . ", " . $_POST['baddress1'] . ", " . $_POST['baddress2'] . ", " . $_POST['baddress3'] . ", " . $_POST['baddress4'] . ", " . $_POST['bcity'] . ", " . $_POST['bcounty'] . ", " . $_POST['bpost_code'] . ", " . $_POST['bcountry'] . ", " . $_POST['nameOnCard'] . ", " . $_POST['card_type'] . ", " . $_POST['card_number'] . ", " . $_POST['exp_month'] . ", " . $_POST['exp_year'] . ", " . $_POST['card_verification_no'] . ", " . $_POST['start_month'] . ", " . $_POST['start_year'] . ", " . $_POST['issue_no'] . " )"); mysql_query($insert_query); ?> Quote Link to comment Share on other sites More sharing options...
liamjw Posted August 11, 2009 Author Share Posted August 11, 2009 Hi, sorry about that, and thanks for your help. I'm still having problems with this I have moved the parentheses inside the quotes but its still not pushing the data into the database, can you see any other erros in my code? Cheers, Liam. Quote Link to comment Share on other sites More sharing options...
Bjom Posted August 12, 2009 Share Posted August 12, 2009 not from what you posted. try echo $insert_query; to see what you actually pass to the server also in the field list you have "county" 2x instead of county and country Quote Link to comment Share on other sites More sharing options...
liamjw Posted August 12, 2009 Author Share Posted August 12, 2009 I used the echo $insert_query; and the session data is being displayed with no problems but it wont push the data in to the data base, I have checked every thing I can think of now but to no avail. No error messages either. Liam. Quote Link to comment Share on other sites More sharing options...
Bjom Posted August 12, 2009 Share Posted August 12, 2009 uhuh. and would you paste it here? 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.