Tenho o codigo abaixo que gera um erro que não estou enxergando.
$fun = [{matricula},{seq},{nome},{cpf},{rg}];
if([cadastra] == “S”){
$insert_table = 'funcionarios'; // Table name
$insert_fields = array( // Field list, add as many as needed
‘field_0’ => $fun[0],
‘field_1’ => $fun[1],
‘field_2’ => $fun[2],
‘field_3’ => $fun[3],
‘field_4’ => $fun[4]
);
// Insert record
$insert_sql = ‘INSERT INTO ’ . $insert_table
. ’ (’ . implode(’, ‘, array_keys($insert_fields)) . ‘)’
. ’ VALUES (’ . implode(’, ', array_values($insert_fields)) . ‘)’;
sc_exec_sql($insert_sql);
}
Que gera o erro seguinte
(pdo-mysql): INSERT INTO funcionarios (field_0, field_1, field_2, field_3, field_4) VALUES (4444, 1, INCLUIDO COM SUCESSO OPAAA, 41054032220, 2387721)
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 ‘COM SUCESSO OPAAA, 41054032220, 2387721)’ at line 1