baris22 Posted October 21, 2009 Share Posted October 21, 2009 Hello, Please help me to get this working This is my current database: This is the current output of my code: I am trying to get: This is my current code: <? include_once ("config/connect.php"); $ref=$_GET['ref']; if (isset($_POST['ok'])) { $worker = $_POST['worker']; $item_id = $_POST['item_id']; for ($i=0;$i<=count($item_id);$i++) { $query5 = mysql_query("UPDATE item SET worker_id = '".$worker[$i]."' WHERE item_id = '".$item_id[$i]."' ") or die(mysql_error()); } } ?> <table width="100%"> <? $query1 = "SELECT * FROM item WHERE order_reference_number='$ref' GROUP BY item_ref"; $portfolio = mysql_query($query1); while($row1 = mysql_fetch_array($portfolio)) { ?> <tr> <td><strong><?=$row1['item_amount'];?> of <?=$row1['item_name'];?></strong></td> </tr> <? } ?> </table> <form action="<?=$PHP_SELF;?>" method="post"> <table width="600" border="0" cellpadding="4" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td height="24" bgcolor="#999999"><strong>Item amount</strong></td> <td height="24" bgcolor="#999999"><strong>Item name</strong></td> <td height="24" bgcolor="#999999"><strong>choice a worker</strong></td> <td height="24" bgcolor="#999999"><strong>chosen worker</strong></td> </tr> <tr> <?php $query99 = "SELECT * FROM item WHERE order_reference_number='$ref' ORDER BY item_name, item_ref"; $portfolio = mysql_query($query99); while($row109 = mysql_fetch_array($portfolio)) { if ($itemRefLast==$row109['item_ref']) { } else { if($skip){ $skipAmount -= 1; ?> <td height="32"></td> <td height="32"> <input name="item_id[]" type="hidden" value="<?=$row109['item_id'];?>" /></td> <?php }else{ ?> <td height="32"> <?=$row109['item_amount'];?></td> <td height="32"> <?=$row109['item_name'];?> <input name="item_id[]" type="hidden" value="<?=$row109['item_id'];?>" /></td> <?php if($skipAmount == 0){ $skip = False; } if($row109['item_amount']>1){ $skip = True; $skipAmount = $row109['item_amount']-1; } } ?> <td> <select name="worker[]" id=""> <option value="<?=$row109['worker_id'];?>"><?=$row109['worker_id'];?></option> <option value="-">-</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></td> <td> <a href="g"> <strong><?=$row109['worker_id'];?></strong> </a></td> </tr><?php $itemRefLast=$row109['item_ref']; } } ?> </table> <input type="submit" name="ok" value="Submit" onClick="return confirmPost()" /> </form> Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 21, 2009 Share Posted October 21, 2009 Did you upload that script to your server? See how stupid of an answer you get when you don't provide details about your problem. Most people won't even look at your code if they have to figure out what errors you MIGHT be getting with no help from you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.