获取SQL错误1136

时间:2016-01-21 06:14:52

标签: php mysqli

我收到SQL错误1136.配置文件正确,它包含$conn变量以及连接到数据库。

 <?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);
}
?>

1 个答案:

答案 0 :(得分:1)

您的查询中存在问题:

您有17 Columns,并且您在查询中插入了18 VALUES