2016-01-21 66 views
0

我得到SQL錯誤1136.配置文件是正確的,它包含$conn變量以及連接到數據庫。獲取SQL錯誤1136

<?php 

include './config.php';  
$field = [ 
    "Test_id", "Testcase_id", "Circle_name", "Performed_date", 
    "Assign_to", "Assign_by", "Status", "Comment", "Device_used", 
    "Testsuite_id", "Simcard_no", "Time", "Review", "Redirection_Issue", 
    "Price_Point_Mismatch_issue", "Subscription_on_first_concent", 
    "Landing_page_Issue" 
]; 


$testid = '12342004'; 
$value = 'TC_3JA_1'; 
$circle = 'Gujarat'; 
$Date_created = '16/01/21'; 
$Assigned_to = 'chirag.parekh'; 
$assign_by = 'brijesh.mashruwala'; 
$current_status = 'Pass'; 
$current_comment = ''; 
$Action = ''; 
$Device = 'Xperia Tipo'; 
$tsuite = 'TS_3JA_7'; 
$mobile = '8141088630'; 
$time = '11:12:54'; 
$review = 'Created'; 
$issue1 = 'Pass'; 
$issue2 = 'Pass'; 
$issue3 = 'Pass'; 
$issue4 = 'Pass'; 
$val = compact(
    "testid", "value", "circle", "Date_created", "Assigned_to", 
    "assign_by", "current_status", "current_comment", "Action", 
    "Device", "tsuite", "mobile", "time", "review", "issue1", 
    "issue2", "issue3", "issue4" 
); 

$sqlreview = "INSERT INTO tmtool.test_result_url (" 
     . implode(",", $field) . ") VALUES ('" . implode("','", $val) . "')"; 

if (mysqli_query($conn, $sqlreview)) { 
    echo "succesful"; 
} else { 
    echo "Failure" . mysqli_errno($conn); 
} 
?> 
+2

列數不符合值計數 –

+0

謝謝@naseeba得到了問題 –

+0

$ Action ='';字段丟失在$ field數組中。你可以請檢查一次! – KinjalMistry

回答

1

您在查詢中有一個問題:

你有17 Columns和你在你的查詢中插入18 VALUES

+0

謝謝@devpro得到了問題 –

+0

@TrilokDethariya:不要忘記關於日期列的Sean的評論,如果datatype是varchar而不是它的罰款 – devpro