0

我正在尝试将数组中的一些值与用户输入的值进行映射。这里 $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 中给出

4

1 回答 1

0

我看到的问题是你正在使用mysql_query而不是mysqli_query

(因此 mysqli_fetch_array 并不真正知道如何解释该参数)

于 2013-03-27T00:57:31.973 回答