我正在尝试将数组中的一些值与用户输入的值进行映射。这里 $actual 来自用户, $target 来自表
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$actual;
$comment; $con;
foreach($_POST['value'] as $country => $value1 ){
foreach($value1 as $goal => $value2){
//value => ["matrix"]
foreach($value2 as $matrix => $value3){
//value => string
$country ." ". $goal." " .$matrix. " " . $value3."<br/>";
if($matrix == "actual"){
$actual = $value3;
}else if($matrix=="comment"){
$comment=$value3;
}
}
$sql="SELECT target FROM target where ini_id = '$ini' and country_id='$country' and metric_id='$goal'";
$result=mysql_query($sql);
$target = mysqli_fetch_array($result);
insert($actual,$target['target'],$country.$ini.$goal ,$comment,$con);
警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,布尔值在第 107 行的 C:\xampp\htdocs\xampp\Testing\sq1.php 中给出