-1
오류 : SQLSTATE는 [HY093] : 잘못된 매개 변수 번호 : 바운드 변수의 수는오류 : SQLSTATE는 [HY093] 삽입에 있지만, 코드에서 오류를 찾을 수 없습니다
이의 우리가 찾고 있다고 가정 해 봅시다 토큰의 수와 일치하지 않습니다 한 행에서 :
$row['ConvLog'] = '12/29/2014 2:44PM - working with the lender to remove the mortgage late so we are able to refinance the client. - User 1 12/04/2014 2:27PM - file suspended until rapid rescore comes back removing late payment from credit. - User 2 12/02/2014 2:25PM - Check stubs to Lorena. - User 3';
아래의 이름으로 내 데이터베이스 열 이름을 세 번 확인했는데 일치합니다. 이 오류가 발생하는 이유는 무엇입니까?
스크립트 : 여기
<?php
$host = 'localhost';
$db_user = '';
$db_pass = '';
$db_name = '';
try {
$pdo = new PDO('mysql:host='.$host.';dbname='.$db_name.'', $db_user, $db_pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare('SELECT * FROM test');
$stmt->execute();
$result = $stmt->fetchAll();
if (count($result)) {
foreach($result as $row) {
$string = $row['ConvLog'];
// $column1 = $row[0]; just the ID, don't need to copy
$column2 = $row[1];
$column3 = $row[2];
$column4 = $row[3];
?>
<?php
preg_match_all('/(.*)([0-9]{2}\/[0-9]{2}\/[0-9]{2,4})(.*)/', $string, $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
echo "matched: " . $val[0] . "<br>";
/* echo "part 1: " . $val[1] . "<br>";
echo "part 2: " . $val[2] . "<br>";
echo "part 3: " . $val[3] . "<br>";
echo "part 4: " . $val[4] . "<br><br>"; */
// start crazy shit
$db_user = '';
$db_pass = '';
try {
$pdo = new PDO('mysql:host=localhost;dbname=', $db_user, $db_pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare('INSERT INTO test4 VALUES(:id,:columnA,:columnB,:Processor,:Originator,:FOLDER,:Filename,:LoanAmount,:Rate,:LastName,:FirstName,:Subject Property Address,:City,:County,:CurrentStatus,:CurrentStartDate,:EstCloseDate,:CreditRpt,:Prospect,:PrePacking,:Application,:SenttoProc,:TitleOrdered,:TitleRecvd,:Submitted,:Approved,:RateLocked,:RateLockedStatus,:RateLock,:RateExp,:Suspended,:ReSubmitted,:CleartoClose,:DocsDrawn,:DocsOut,:Docs Recd,$column2:Closed,:Funded,:Recorded,:Denied,:Cancelled,:LOHold,:LoHoldField,:EscrowHold,:EscrowHoldField,:Loan Program,:CC Scenario,:Subject Property State,:Subject Property Zip Code,:Broker Fee,:Broker Pts,:Broker Flat,:Lender Name,:Lender Cpny Name,:Appraisal Rpt,:Late Basic Docs,:Late Miscellaneous,:Late VODs,:Late VOEs,:Late VOLs,:Late VOMs,:Outstanding Docs,:Outstanding Misc,:Outstanding Verifs,:Outstanding Conditions,:Purc,:Escrow Company,:Appraisal Ordered,:ConvLog,:Appraisal Required,:Suspended Reason,:LO Hold Reason,:Escrow Hold Reason,:Appraisal Ordered Status,:AppraisalOrderedField,:Subordination Ordered Status,:SubordinationOrderedField,:PreUnderwriting Status,:PreUnderwritingField
)');
$stmt->execute(array(
':id' => '', ':columnA' => $column2, ':columnB' => $column3, ':Processor' => 'test', ':Originator' => 'test', ':FOLDER' => 'test', ':Filename' => 'test', ':LoanAmount' => 'test', ':Rate' => 'test', ':LastName' => 'test', ':FirstName' => 'test', ':Subject Property Address' => 'test', ':City' => 'test', ':County' => 'test', ':CurrentStatus' => 'test', ':CurrentStartDate' => 'test', ':EstCloseDate' => 'test', ':CreditRpt' => 'test', ':Prospect' => 'test', ':PrePacking' => 'test', ':Application' => 'test', ':SenttoProc' => 'test', ':TitleOrdered' => 'test', ':TitleRecvd' => 'test', ':Submitted' => 'test', ':Approved' => 'test', ':RateLocked' => 'test', ':RateLockedStatus' => 'test', ':RateLock' => 'test', ':RateExp' => 'test', ':Suspended' => 'test', ':ReSubmitted' => 'test', ':CleartoClose' => 'test', ':DocsDrawn' => 'test', ':DocsOut' => 'test', ':Docs Recd' => 'test', ':Closed' => 'test', ':Funded' => 'test', ':Recorded' => 'test', ':Denied' => 'test', ':Cancelled' => 'test', ':LOHold' => 'test', ':LoHoldField' => 'test', ':EscrowHold' => 'test', ':EscrowHoldField' => 'test', ':Loan Program' => 'test', ':CC Scenario' => 'test', ':Subject Property State' => 'test', ':Subject Property Zip Code' => 'test', ':Broker Fee' => 'test', ':Broker Pts' => 'test', ':Broker Flat' => 'test', ':Lender Name' => 'test', ':Lender Cpny Name' => 'test', ':Appraisal Rpt' => 'test', ':Late Basic Docs' => 'test', ':Late Miscellaneous' => 'test', ':Late VODs' => 'test', ':Late VOEs' => 'test', ':Late VOLs' => 'test', ':Late VOMs' => 'test', ':Outstanding Docs' => 'test', ':Outstanding Misc' => 'test', ':Outstanding Verifs' => 'test', ':Outstanding Conditions' => 'test', ':Purc' => 'test', ':Escrow Company' => 'test', ':Appraisal Ordered' => 'test', ':ConvLog' => 'test', ':Appraisal Required' => 'test', ':Suspended Reason' => 'test', ':LO Hold Reason' => 'test', ':Escrow Hold Reason' => 'test', ':Appraisal Ordered Status' => 'test', ':AppraisalOrderedField' => 'test', ':Subordination Ordered Status' => 'test', ':SubordinationOrderedField' => 'test', ':PreUnderwriting Status' => 'test', ':PreUnderwritingField' => 'test'
));
} catch(PDOException $e) {
echo 'Error: ' . $e->getMessage();
}
// end crazy shit
}
?>
<?php
}
} else {
echo "No rows returned.";
}
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
?>
는 5 열 예입니다,하지만 난 여전히이 역 따옴표와 함께 동작하지 않습니다. 나는 하나의 백틱으로, 다른 하나는 둘 다로 시도했다. 내가 도대체 뭘 잘못하고있는 겁니까? 5 열에 대한
$stmt = $pdo->prepare('INSERT INTO test2 VALUES(:id,`:my number`,:blah,:cool,:notes)');
$stmt->execute(array(
':id' => '', `:my number` => $column2, ':blah' => $column3, ':cool' => $column4, 'notes' => $val[0]
));
업데이트 예 :
$stmt = $pdo->prepare('INSERT INTO test2 (id, `my number`, blah, cool, notes) VALUES (?, ?, ?, ?, ?)');
$stmt->execute(array('', 'test', 'test', 'test','test'));
을 강조 = 바로 거기 주제 재산권 Address' <. 공백을 사용할 때는 모든 열 이름을'\''틱으로 감싸십시오. 그것은 하나 뿐이며 다른 사람들도 있습니다. 그렇다면'$ column2 : Closed'가있어서 당신이 여기서하고 싶은 것이 확실하지 않습니다. 이것은 디버그 질문입니다. 이 문제를 해결하고 대답을 제출하려는 사람. *행운을 빕니다*. 당신은 당신 앞에서 꽤 많은 일을했습니다. –
* "코드에서 오류를 찾을 수 없습니다."* - 이것은 당신에게 말하고 있습니다. 그 중 하나에 의해 시작하고, 당신에게 줄 다음 오류로 이동하십시오. –
와우, 잘 잡으세요. $ column2 : Closed는 다음과 같아야합니다. Closed, var가 어떻게 거기에 들어 왔는지 확실하지 않습니다. 다시 틱으로 업데이트 할 것입니다. – Yoda