我正在尝试使用用户输入的值映射数组中的某些值。 这里$ 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中给出布尔值
答案 0 :(得分:0)
我看到的问题是您使用的是mysql_query
而不是mysqli_query
(因此mysqli_fetch_array并不真正知道如何解释该参数)