jwwceo Posted December 18, 2007 Share Posted December 18, 2007 I have been staring at this query for an hour. It gives me a SYNTAX error. Any ideas?? James $query="INSERT INTO user ( name_last, name_first, email, password, username, address_home, city_home, state_home, zip_home, country_home, phone_home, address_bill, city_bill, state_bill, zip_bill, country_bill, phone_bill, citizenship) VALUES ( {$_SESSION['name_last_v']}, {$_SESSION['name_first_v']}, {$_SESSION['email_v']}, {$_SESSION['password_v']}, {$_SESSION['username_v']}, {$_SESSION['address_home_v']}, {$_SESSION['city_home_v']}, {$_SESSION['state_home_v']}, {$_SESSION['zip_home_v']}, {$_SESSION['country_home_v']}, {$_SESSION['phone_home_v']}, {$_SESSION['address_bill_v']}, {$_SESSION['city_bill_v']}, {$_SESSION['$state_bill_v']}, {$_SESSION['$zip_bill_v']}, {$_SESSION['$country_bill_v']}, {$_SESSION['$phone_bill_v']}, {$_SESSION['$citizenship_v']})"; Quote Link to comment Share on other sites More sharing options...
boushley Posted December 18, 2007 Share Posted December 18, 2007 Whats the exact error? What values are being passed in? Whats the table structure look like? Quote Link to comment Share on other sites More sharing options...
papaface Posted December 18, 2007 Share Posted December 18, 2007 Should be: $query="INSERT INTO user ( name_last, name_first, email, password, username, address_home, city_home, state_home, zip_home, country_home, phone_home, address_bill, city_bill, state_bill, zip_bill, country_bill, phone_bill, citizenship) VALUES ( ".$_SESSION['name_last_v'].", ".$_SESSION['name_first_v'].", ".$_SESSION['email_v'].", ".$_SESSION['password_v'].", ".$_SESSION['username_v'].", ".$_SESSION['address_home_v'].", ".$_SESSION['city_home_v'].", ".$_SESSION['state_home_v'].", ".$_SESSION['zip_home_v'].", ".$_SESSION['country_home_v'].", ".$_SESSION['phone_home_v'].", ".$_SESSION['address_bill_v'].", ".$_SESSION['city_bill_v'].", ".$_SESSION['$state_bill_v'].", ".$_SESSION['$zip_bill_v'].", ".$_SESSION['$country_bill_v'].", ".$_SESSION['$phone_bill_v'].", ".$_SESSION['$citizenship_v'].")"; I think Quote Link to comment Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 All your values need surrounding single quotes. Quote Link to comment Share on other sites More sharing options...
papaface Posted December 18, 2007 Share Posted December 18, 2007 So: $query="INSERT INTO user ( name_last, name_first, email, password, username, address_home, city_home, state_home, zip_home, country_home, phone_home, address_bill, city_bill, state_bill, zip_bill, country_bill, phone_bill, citizenship) VALUES ( '".$_SESSION['name_last_v']."', '".$_SESSION['name_first_v']."', '".$_SESSION['email_v']."', '".$_SESSION['password_v']."', '".$_SESSION['username_v']."', '".$_SESSION['address_home_v']."', '".$_SESSION['city_home_v']."', '".$_SESSION['state_home_v']."', '".$_SESSION['zip_home_v']."', '".$_SESSION['country_home_v']."', '".$_SESSION['phone_home_v']."', '".$_SESSION['address_bill_v']."', '".$_SESSION['city_bill_v']."', '".$_SESSION['$state_bill_v']."', '".$_SESSION['$zip_bill_v']."', '".$_SESSION['$country_bill_v']."', '".$_SESSION['$phone_bill_v']."', '".$_SESSION['$citizenship_v']."')"; Quote Link to comment Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 The op's original method is also correct, just missing the quotes. eg; {$_SESSION['name_last_v']}, needs to be.... '{$_SESSION['name_last_v']}', Quote Link to comment Share on other sites More sharing options...
jwwceo Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks guys. That did it!!! 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.