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']})"; Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/ 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? Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417706 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 Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417707 Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 All your values need surrounding single quotes. Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417714 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']."')"; Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417717 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']}', Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417720 Share on other sites More sharing options...
jwwceo Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks guys. That did it!!! Link to comment https://forums.phpfreaks.com/topic/82198-solved-query-seems-right-to-me/#findComment-417722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.