i am unable to update my table after submitting array data. ex: 1. Product Name: DELL 329 Quantity :5 Rate :2500 Amount :12500 2. Product Name:Dell 21 Quantity :8 Rate :1800 Amount :14400
but only last index of array is update in table
like Product Name:Dell 21 Quantity :8 Rate :1800 Amount :14400 Product Name:Dell 21 Quantity :8 Rate :1800 Amount :14400
$in_no=$_POST['in_no'];
//enter rows into item_info table
foreach($_POST['p_name'] as $row=>$nm)
{
$p_name=mysql_real_escape_string($nm);
$quantity=mysql_real_escape_string($_POST['quantity'][$row]);
$rate=mysql_real_escape_string($_POST['rate'][$row]);
$amount=mysql_real_escape_string($_POST['amount'][$row]);
echo "Product Name:".$p_name." Quantity :".$quantity." Rate :".$rate." Amount :".$amount."<br/>";
$involv = "UPDATE item_info set `p_name`='$p_name', `quantity`='$quantity', `rate`='$rate', `amount`='$amount' where `in_no`='$in_no'";
mysql_query($involv);
`
in_no
='$in_no') multiple times inside the loop. – cartina Jun 10 '13 at 12:05