it display the record but when I save it. it doesnt work. please have a check on my array query.
<form action="saveupdaterecord.php" class="form-horizontal" role="form" method="post">
<table>
<tr>
<?php
$result = $db->prepare("SELECT * FROM famcomp WHERE app_id='". mysql_real_escape_string($app_id) ."'");
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
?>
<td><input type="hidden" name="app_id[]" value="<?php echo $row['app_id']; ?>" /></td>
<td><input type="text" name="fullname[]" value="<?php echo $row['fullname']; ?>" class="input" /></td>
<td><input type="text" name="fage[]" value="<?php echo $row['fage']; ?>" class="input" /></td>
<td><input type="text" name="frel[]" value="<?php echo $row['frel']; ?>" class="input" /></td>
<td><input type="text" name="fcivil[]" value="<?php echo $row['fcivil']; ?>" class="input" /></td>
<td><input type="text" name="fedu[]" value="<?php echo $row['fedu']; ?>" class="input" /></td>
<td><input type="text" name="foccup[]" value="<?php echo $row['foccup']; ?>" class="input" /></td>
<td><input type="text" name="finco[]" value="<?php echo $row['finco']; ?>" class="input" /></td>
</tr>
<?php
}
?>
<br></table></form>
saveupdaterecord.php
$fullname=$_POST['fullname'];
$N = count($fullname);
for($i=0; $i < $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 "<SCRIPT>alert('$message');</SCRIPT>";
echo "<script>windows: location='editrecord.php?name=$a'</script>";