title: PHP updating table from values with multidimensional array
body: <p>My php code is</p>
  
  <pre><code>for($i=1;$i&lt;$rows;$i++)
  {
      $flag=0;
     $result = mysqli_query($con,"SELECT id FROM `TABLE 1` ");
     while($row = mysqli_fetch_array($result))
     {
       //echo $row['id']."&lt;br&gt;";
       echo $cols[$i][0];
       if($row['id']==$cols[$i][0])//id exists in database=&gt; update
       {
          echo"&lt;br&gt; ".$cols[$i][4];
          mysqli_query($con,"UPDATE `TABLE 1` SET `price`=$cols[$i][4]  WHERE `id`=07");
          //echo $cols[$i][0];
          $flag=1;
       }
      }
      if($flag==0)//Add new record in to database
      {
         //code for insert
      } 
  }
  </code></pre>
  
  <p>It does not update the price</p>
  
  <blockquote>
    <p>mysqli_query($con,"UPDATE <code>TABLE 1</code> SET <code>price</code>=$cols[$i][4]  WHERE <code>id</code>=07");</p>
  </blockquote>
  
  <p>It update the value i.e. price if I enter it e.g.</p>
  
  <blockquote>
    <p>mysqli_query($con,"UPDATE <code>TABLE 1</code> SET <code>price</code>=100  WHERE <code>id</code>=07");</p>
  </blockquote>
  
  <p><code>$cols[$i][4]</code> Is an array and it gives the correct value when I echo it, but when the same value is applied for the update statement it does not take it.</p>