title: How to update multiple table row array in php mysql
body: <p>it display the record but when I save it. it doesnt work. please have a check on my array query.   </p>
  
  <pre><code>&lt;form action="saveupdaterecord.php" class="form-horizontal" role="form" method="post"&gt;   
      &lt;table&gt;
                    &lt;tr&gt;
                       &lt;?php
              $result = $db-&gt;prepare("SELECT * FROM famcomp WHERE app_id='".     mysql_real_escape_string($app_id) ."'");
              $result-&gt;execute();
              for($i=0; $row = $result-&gt;fetch(); $i++){
            ?&gt;
                      &lt;td&gt;&lt;input type="hidden" name="app_id[]" value="&lt;?php echo $row['app_id']; ?&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="fullname[]" value="&lt;?php echo $row['fullname']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="fage[]" value="&lt;?php echo $row['fage']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="frel[]" value="&lt;?php echo $row['frel']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="fcivil[]" value="&lt;?php echo $row['fcivil']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="fedu[]" value="&lt;?php echo $row['fedu']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="foccup[]" value="&lt;?php echo $row['foccup']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="finco[]" value="&lt;?php echo $row['finco']; ?&gt;" class="input" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;    
                  &lt;?php
                      }
                  ?&gt;
      &lt;br&gt;&lt;/table&gt;&lt;/form&gt;
  </code></pre>
  
  <p>saveupdaterecord.php</p>
  
  <pre><code>$fullname=$_POST['fullname'];
  $N = count($fullname);
  for($i=0; $i &lt; $N; $i++)
  mysql_query("UPDATE 'famcomp' SET 'fullname' = '".$_POST["fullname[$i]"]."', fage = '".$_POST["fage[$i]"]."', frel = '".$_POST["frel[$i]"]."', fcivil = '".$_POST["fcivil[$i]"]."', fedu = '".$_POST["fedu[$i]"]."', foccup = '".$_POST["foccup[$i]"]."', finco = '".$_POST["finco[$i]"]."' WHERE `app_id` = '".$_POST["app_id"]."'"); // Run the Mysql update query inside for loop
  $message = 'Success Updating the record!!';
  echo "&lt;SCRIPT&gt;alert('$message');&lt;/SCRIPT&gt;";
  echo "&lt;script&gt;windows: location='editrecord.php?name=$a'&lt;/script&gt;";
  </code></pre>