2015-11-04 57 views
0

我已經創建了一個龐大的更新查詢,並檢查很多次,如果everithing是正確生成,但服務器返回我這個錯誤:**「未捕獲的異常‘PDOException’有消息好奇Mysql的更新錯誤

'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 27'"

我將不勝感激,如果你能解釋一下我哪裏有錯誤可能來自感謝

$update_query = $dbh->prepare('UPDATE Credit_Requests 
    SET creditAmount = :creditAmount, duration = :duration, insurance =  :insurance, 
title = :title, lastName = :lastName, firstName = :firstName, birthDay = :birthDay, street = :street, 
number = :number, zipCode = :zipCode, city = :city, country = :country, streetPrevious = :streetPrevious, 
numberPrevious = :numberPrevious, liveSince = :liveSince, mobilePhone = :mobilePhone, homePhone = :homePhone, 
email = :email, workPhone = :workPhone, maritalStatus = :maritalStatus, nationality = :nationality, 
permit = :permit, expire = :expire, border = :border, professional_status = :professional_status, 
employedSince = :employedSince, employedUntil = :employedUntil, employerName = :employerName, 
streetEmployer = :streetEmployer, numberEmployer = :numberEmployer, zipCodeEmployer = :zipCodeEmployer, 
cityEmployer = :cityEmployer, typeRevenu = :typeRevenu, yearlyBonus = :yearlyBonus, salary13th = :salary13th, 
additionalWork = :additionalWork, additionalRevenue = :additionalRevenue, 
secondEmployerName = :secondEmployerName, secondStreetEmployer = :secondStreetEmployer, 
secondNumberEmployer = :secondNumberEmployer, secondZipCodeEmployer = :secondZipCodeEmployer, 
secondCityEmployer = :secondCityEmployer, secondEmployedSince = :secondEmployedSince, 
thirdEmployerName = :thirdEmployerName, anoterAdditionalRevenue = :anoterAdditionalRevenue, 
liveWith = :liveWith, spouse = :spouse, spouseTitle = :spouseTitle, spouseFirstName = :spouseFirstName, 
birthday_spouse = :birthday_spouse, spouseProfessionalStatus = :spouseProfessionalStatus, 
spouseEmployerName = :spouseEmployerName, spouseZipCodeEmployer = :spouseZipCodeEmployer, 
spouseCityEmployer = :spouseCityEmployer, spouseAddRevenue = :spouseAddRevenue, 
spouseTypeRevenue = :spouseTypeRevenue, revenueSpouse13th = :revenueSpouse13th, 
spouseChildren = :spouseChildren, children06 = :children06, children610 = :children610, 
children12 = :children12, addExpense = :addExpense, leasing1 = :leasing1, leasing1Bank = :leasing1Bank, 
credit1 = :credit1, credit1Bank = :credit1Bank, credit2 = :credit2, credit2Bank = :credit2Bank, 
otherBankCreditAmount = :otherBankCreditAmount, otherBankLocation = :otherBankLocation, 
regularExpenses = :regularExpenses, restraininOrder = :restraininOrder, 
restraininOrderAmount = :restraininOrderAmount, notes = :notes, refinance = :refinance, 
seizure = :seizure, id_status = :id_status, id_lang = :id_lang WHERE id = 1) 
'); 

$update_query->execute(array(

'creditAmount' => $creditAmount, 
'duration' => $duration, 
'insurance' => $insurance, 
'title' => $title, 
'lastName' => $lastName, 
'firstName' => $firstName, 
'birthDay' => $birthDay, 
'street' => $street, 
'number' => $number, 
'zipCode' => $zipCode, 
'city' => $city, 
'country' => $country, 
'streetPrevious' => $streetPrevious, 
'numberPrevious' => $numberPrevious, 
'liveSince' => $liveSince, 
'mobilePhone' => $mobilePhone, 
'homePhone' => $homePhone, 
'email' => $email, 
'workPhone' => $workPhone, 
'maritalStatus' => $maritalStatus, 
'nationality' => $nationality, 
'permit' => $permit, 
'expire' => $expire, 
'border' => $border, 
'professional_status' => $professional_status, 
'employedSince' => $employedSince, 
'employedUntil' => $employedUntil, 
'employerName' => $employerName, 
'streetEmployer' => $streetEmployer, 
'numberEmployer' => $numberEmployer, 
'zipCodeEmployer' => $zipCodeEmployer, 
'cityEmployer' => $cityEmployer, 
'typeRevenu' => $typeRevenu, 
'yearlyBonus' => $yearlyBonus, 
'salary13th' => $salary13th, 
'additionalWork' => $additionalWork, 
'additionalRevenue' => $additionalRevenue, 
'secondEmployerName' => $secondEmployerName, 
'secondStreetEmployer' => $secondStreetEmployer, 
'secondNumberEmployer' => $secondNumberEmployer, 
'secondZipCodeEmployer' => $secondZipCodeEmployer, 
'secondCityEmployer' => $secondCityEmployer, 
'secondEmployedSince' => $secondEmployedSince, 
'thirdEmployerName' => $thirdEmployerName, 
'anoterAdditionalRevenue' => $anoterAdditionalRevenue, 
'liveWith' => $liveWith, 
'spouse' => $spouse,  
'spouseTitle' => $spouseTitle, 
'spouseFirstName' => $spouseFirstName, 
'birthday_spouse' => $birthday_spouse, 
'spouseProfessionalStatus' => $spouseProfessionalStatus, 
'spouseEmployerName' => $spouseEmployerName, 
'spouseZipCodeEmployer' => $spouseZipCodeEmployer, 
'spouseCityEmployer' => $spouseCityEmployer, 
'spouseAddRevenue' => $spouseAddRevenue, 
'spouseTypeRevenue' => $spouseTypeRevenue, 
'revenueSpouse13th' => $revenueSpouse13th, 
'spouseChildren' => $spouseChildren, 
'children06' => $children06, 
'children610' => $children610, 
'children12' => $children12, 
'addExpense' => $addExpense, 
'leasing1' => $leasing1, 
'leasing1Bank' => $leasing1Bank, 
'credit1' => $credit1, 
'credit1Bank' => $credit1Bank, 
'credit2' => $credit2, 
'credit2Bank' => $credit2Bank, 
'otherBankCreditAmount' => $otherBankCreditAmount, 
'otherBankLocation' => $otherBankLocation, 
'regularExpenses' => $regularExpenses, 
'restraininOrder' => $restraininOrder, 
'restraininOrderAmount' => $restraininOrderAmount, 
'notes' => $notes, 
'refinance' => $refinance, 
'seizure' => $seizure, 
'id_status' => $id_status, 
'id_lang' => $lang 
)); 
header('Location: ' .$_SERVER['PHP_SELF']. ''); 
} 

回答

3

拆除支架:。

WHERE id = 1) 

到:

WHERE id = 1 

或包裹整個條件:

WHERE (id = 1) 
+0

非常感謝你。我好累... – user5468779

+1

@ user5468779不客氣。不要忘記打勾asmewer http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 :) – lad2025

+0

非常感謝:-) – user5468779