你们能帮我这个代码吗,请完美地连接到mysql并读取json文件,但还要证明在json parse中也可以看到array(array [0] ...
require_once('conn_v2_1.php');
$json = file_get_contents('results.json');
$data = json_decode($json, true);
foreach ( $data as $inv ) {
$record_id= $inv['$record_id'];
$contact_info= $inv['contact_info'];
$contact_info_type= $inv['contact_info_type'];
$record_type= $inv['record_type'];
$record_status= $inv['record_status'];
$call_result= $inv['call_result'];
$attempt= $inv['attempt'];
$daily_from= $inv['daily_from'];
$daily_till= $inv['daily_till'];
$tz_dbid= $inv['tz_dbid'];
$email_subject= $inv['email_subject'];
$chain_id= $inv['chain_id'];
$chain_n= $inv['chain_n'];
$direccion= $inv['direccion'];
$NomCliente= $inv['NomCliente'];
$Contrato= $inv['Contrato'];
$st = mysqli_prepare($conn,'INSERT INTO oficinas_contestadas
(record_id,contact_info, contact_info_type, record_type,
record_status,call_result,attempt,
daily_from,daily_till,tz_dbid,email_subject,chain_id,chain_n,
direccion,NomCliente,Contrato)
VALUES($record_id,$contact_info,$contact_info_type,$record_type,
$record_status,$call_result,$attempt,$daily_from,$daily_till,
$tz_dbid,$email_subject,$chain_id,$chain_n,$direccion,
$NomCliente,$Contrato)') or
die(mysqli_error($conn));
// bind variables to insert query params
mysqli_stmt_bind_param($record_id,$contact_info,$contact_info_type,
$record_type,$record_status,$call_result,$attempt,$daily_from,
$daily_till,$tz_dbid,$email_subect,$chain_id,$chain_n,
$direccion,$NomCliente,$Contrato);
// executing insert query
mysqli_stmt_execute($st);
}
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
?>
我收到此错误
注意:未定义的索引:在第44行的http:localhost / autoload.php中是相反的 “字段列表”中的未知列“ record_id”