Q:

Mapping a static value to a static value

I'm trying to map some values from an array with values entered by users.
    Here $actual comes from user and $target is fed from a  table 
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);

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\xampp\Testing\sq1.php on line 107

A:

The problem I see is you are using mysql_query instead of mysqli_query
(And thus mysqli_fetch_array doesn't really know how to interprete that argument)

