Trilok Dethariya Trilok Dethariya - 29 days ago 5
PHP Question

Getting SQL error 1136

I am getting SQL error 1136. Config file is correct and it contains

$conn
variable as well as connecting to the database.

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

Answer

You have an issue in your query:

You have 17 Columns and you are inserting 18 VALUES in your Query.

Comments