dppcyt6157 2018-02-18 18:59
浏览 60
已采纳

我的SQL语法错误让我反复头痛

There is a problem signing you up. You have an error in your SQL syntax;

check the manual that corresponds to your MariaDB server version for the right syntax to use near 'way', 'ENGLAND', 'sn66er', 'Home Owner', '6months', '1793321653', '', 'state', '' at line 1

Hello, new to PHP and am struggling with the code as everything I try to run, I get this error. Please, what am I missing? I have checked the other related questions and tried everything without success:

$query = "INSERT INTO users  (Title, username, password, marital_status,
dependents, name, lastname, email, loan_purpose, employment_status,
employer_name, work_address, work_region, work_postcode, work_mobile,
employment_type, time_employer, payment_frequency, wages_paid_into_account, 
othermonthly_income, rent_mortgages, creditcards_loans, 
othermonthly_expenses, account_name, bank_name, account_no, sortcode,
yearswith_bank, heard_about_us, address, region, postcode, residential_type,
time_address, mobile, landline, county, birthdate, income, nextpaydate, Loanamount, Terms, Monthlyrepayment, Totalrepayment, Interest, gender)
VALUES ('$title', '$username',  '$password', '$maritalstatus', '$dependant',
'$name', '$lastname', '$email', '$loanPurpose', '$employmentStatus', 
'$employerName', '$employerAddress', '$employerRegion', '$workpostcode', 
'$workphone', '$employmentType', '$employmentLength', '$paymentFrequency',
'$howYouGetPaid', '$otherIncome', '$rent_mortgage',
'$creditCard_loansExpenses', '$otherMonthlyExpenses', '$accountName',
'$bankName', '$accountNumber', '$sortCode', '$accountLength',
'$hearAboutUs',  $address', '$region', '$postcode', '$tenancyType', 
'$timeatAddress', '$mobilenumber', '$landline', '$county', '$birth',
'$income', '$nextPay', '$loanamount', '$terms', '$monthlyrepayment',
'$totalrepayment', '$interest', '$gender')";


if (mysqli_query($connection, $query)){     
    $_SESSION["username"] =$username; 
    echo " Successfully logged in";
    header("location: login.php");
}
    //create a variable to see if it went through
    // $result =  mysqli_query($connection,  $query ); // assign variable
else{

    die("<p> There is a problem signing you up.</p>" . mysqli_error($connection));

}
  • 写回答

2条回答 默认 最新

  • duanchigeng4313 2018-02-18 19:42
    关注

    missing single quote before $address

    $query = "INSERT INTO users (Title, username, password, marital_status, dependents,
                 name, lastname, email, loan_purpose, employment_status, employer_name, 
                 work_address, work_region, work_postcode, work_mobile, employment_type, 
                 time_employer, payment_frequency, wages_paid_into_account,
                  othermonthly_income, rent_mortgages, creditcards_loans, 
                  othermonthly_expenses, account_name, bank_name, account_no, 
                  sortcode, yearswith_bank, heard_about_us, address, region, 
                  postcode, residential_type, time_address, mobile, landline, 
                  county, birthdate, income, nextpaydate, Loanamount, Terms, 
                  Monthlyrepayment, Totalrepayment, Interest, gender) 
          VALUES ('$title', '$username', '$password', '$maritalstatus', '$dependant', 
              '$name', '$lastname', '$email', '$loanPurpose', '$employmentStatus', 
              '$employerName',  '$employerAddress', '$employerRegion', '$workpostcode', '$workphone', 
              '$employmentType',  '$employmentLength', '$paymentFrequency', '$howYouGetPaid', '$otherIncome', 
              '$rent_mortgage', '$creditCard_loansExpenses', '$otherMonthlyExpenses', '$accountName', 
              '$bankName', '$accountNumber', '$sortCode', '$accountLength', '$hearAboutUs', '$address', 
              '$region', '$postcode', '$tenancyType', '$timeatAddress', '$mobilenumber',
               '$landline', '$county', '$birth', '$income', '$nextPay', '$loanamount', '$terms', 
           '$monthlyrepayment', '$totalrepayment', '$interest', '$gender')";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能