Array problem again.
| From: | Martin Skjöldebrand | Date: | Mon, 16 Apr 2001 15:08:55 +0000 |
| Subject: | Array problem again. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-48772@lists.php.net to get a copy of this message | ||
I'm trying to edit the specific item for each row found in the snippet
below. Each item gets a row in a table and I want to pass the item Id (s_id
below) to $item. It seems however that the array *item * is not
incrementing. For all rows I get the value of the first row.
Any ideas of what wrong?
M.
<?
/*
Get isstock value and if there is stock registered add a table row for
each item.
*/
if ($isstock >0) {
for ($i = 0; $i <= $isstock -1; $i++) {
$item[$i] = $row['s_id'];
print "<input type='hidden' name='what' value=$item[$i]>";
$row = mysql_fetch_array($query_res);
print "<tr>";
print " <td>".$row['s_id']."</td>";
print " <td>".$row['s_description']."</td>";
print " <td>".$row['s_price']."</td>";
print " <td>".$row['s_stock_quantity']."</td>";
print " <td>N/I</td>";
print " <td>N/I</td>";
print " <td><input name='action' value='Edit'
type='submit'><input
name='action' value='Delete' type='submit'></td>";
print "</tr>";
}
}
?>