Can any one help on this issue.When i'm trying to updating multiple record using catid(it contain same catid one or more) it is not updating results.
Below is the code
enter code here
<?php
//select a database to work with
$selected = mysql_select_db("db_name",$cnn) or die("Could not select examples");
$sql="SELECT *
FROM `plannedbudgetstbl`
LEFT JOIN budget_categories ON plannedbudgetstbl.cat_id = budget_categories.cat_id
WHERE programid ='".$id."'";
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
?>
<form name="form1" method="post" action="">
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center"><strong>budget</strong></td>
</tr>
<?php
// Check if button name "submit" is active, do this
if (isset($_POST['submit'])) {
$budget = $_POST['budget'];
for($i=0;$i<$count;$i++){
$sql1="UPDATE plannedbudgetstbl SET budget='".$budget[$i]."' WHERE programid = '".$id[$![enter image description here][1]i]."'and cat_id='".$id[$i]."'";
$result1=mysql_query($sql1);
}
}
if(isset($result1)){
header("location:budget-dispaly1.php");
}
?>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center"><?php $id[]=$rows['cat_id']; ?><?php echo $rows['cat_id']; ?></td>
<td align="center"><input name="budget[]" type="text" id="budget" value="<?php echo $rows['budget']; ?>"></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4" align="center"><input type="submit" name="submit" value="submit"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
Here is the update output