ユーザーが入力した値を使用して、配列からいくつかの値をマップしようとしています。ここで、$ 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で指定されています。