Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

What is wrong in here?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

baris22

Established Member
Impact
1
Hello all,

I need some help. This is my database:

a.gif


This is the output of my code:

c.gif


When I submit the form it only updates the first row. It does not update the second one.

b.gif


Can you please help me.
Thanks

PHP:
<?
include_once ("config/connect.php");
$ref=$_GET['ref'];

if (isset($_POST['ok'])) 
{
     $item_name = $_POST['item_name'];
     $worker = $_POST['worker'];	 
     $item_id = $_POST['item_id'];

     for ($i=0;$i<count($_POST['item_id']);$i++) {

     $query5 = mysql_query("UPDATE item SET item_name = '".$item_name[$i]."', worker_id = '".$worker[$i]."' WHERE item_id = '".$item_id[$i]."' ") or die(mysql_error());
     }            
}

?>


<?php
$query1 = "SELECT * FROM item WHERE order_reference_number='$ref' GROUP BY item_amount";
$portfolio = mysql_query($query1);
while($row1 = mysql_fetch_array($portfolio)) {
?>
<table width="100%">
<tr>
<td valign="top" width="266">
<?=$row1['item_amount'];?> of 
<input name="item_name[]" type="text" value="<?php echo $row1['item_name'];?>" size="30" />
<input name="item_id[]" type="hidden" value="<?=$row1['item_id'];?>" />
</td>
<td width="480">
<?php
for ($i=0; $i<$row1['item_amount']; $i++) {
?>
Choice a worker for this job

<select name="worker[]" id="">
<option value="Select">Select</option>
<?php  
$query3 = "SELECT * FROM worker";
$portfolio1 = mysql_query($query3);
while($row3 = mysql_fetch_array($portfolio1)) {
?>    
<option><?php echo $row3['worker_name'];?></option>
<?php } ?>
</select><br /><br />

<?php
}
?>
</td>
</tr>
</table>
<?php } ?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Wawww,

thank you very much. you made my day.
 
0
•••
no problem =]

reps appriciated (even if it took ages cos of my own mistake)
Will charge next time :( ;)
 
0
•••
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back