我有一个数组,用于将值存储到特定字段。我想在这里做的是在这个数组中添加一个额外的字段名称和值。我该怎么办?
array_walk($files_data, 'array_sanitize');
$fields = '`'.implode('` , `', array_keys($files_data)).'`';
$data = '\''.implode('\', \'',$files_data).'\'';
mysqli_query($dbCon,"INSERT INTO users_info($fields) VALUES ($data) ");
答案 0 :(得分:1)
$files_data['yourFieldName'] = $yourValue;
array_walk($files_data, 'array_sanitize');
$fields = '`'.implode('` , `', array_keys($files_data)).'`';
$data = '\''.implode('\', \'',$files_data).'\'';
mysqli_query($dbCon,"INSERT INTO users_info($fields) VALUES ($data) ");