Jump to content

[SOLVED] Query Seems right to me??


jwwceo

Recommended Posts

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

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

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']."')";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.