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条)

报告相同问题?

悬赏问题

  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复