update query not working in array

Posted by Suresh PHP Begginer on Stack Overflow See other posts from Stack Overflow or by Suresh PHP Begginer
Published on 2012-04-13T04:38:46Z Indexed on 2012/04/13 5:28 UTC
Read the original article Hit count: 141

Filed under:

here my code: i want to update the field by array. i just fetch the data's from table then i want to update the the field for same table

// select query to get the value
    for($j=0;$j<count($capacity);$j++)
   {  
     $capaci=$capacity[$j];
    // select query to get the value
     $sql2=mysql_query("SELECT recieved-allocate*plate_quantity as ans from total_values where capacity='$capaci'"); 
     while($fetch=mysql_fetch_array($sql2)) 
     {
      $recieves=$fetch['ans'];
      $sql3="update total_values set recieved='$recieves' where capacity='$capaci' and month='$mon'";
      mysql_query($sql3);
     }
    }

© Stack Overflow or respective owner

Related posts about php