Looping. Please help....Urgent
Hi, try many time not work so get help.....
I have following code in add.php page:
<form action= "add_process.php" id= "form1" method= "post">
<table width="70%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><b>FG ID: </td>
<td> <input name= "fg_id" maxlength= 20>**</td>
</tr>
<tr>
<td><b>Product ID: </td>
<td> <input name= "prod_id" maxlength= 20>*</td>
</tr>
<tr>
<td><b>S/N: </td>
<td> <input name= "s1">**</td>
</tr>
<tr>
<td><b>I/O: </td>
<td> <input name= "io">*</td>
</tr>
<tr>
<td><b>Lot Control: </td>
<td> <input type= "radio" name= "lot_control" value ="Y"> Yes
<input type= "radio" name= "lot_control" value ="N" CHECKED> No</td>
</tr>
<tr>
<td> <input type= "hidden" name= "rej" value="N"></td>
</tr>
<tr>
<td><b>Lot Quantity: </td>
<td> <input name= "lot_qty"></td>
</tr>
<tr>
<td><b>Quantity: </td>
<td> <input name= "qty"></td>
</tr>
The product have many component board categories by lot control and S/N.
If lot control = Yes then have lot quantity is 500 , same S/N.
If lot control = No then quantity = 100, each lot quantity is 1 and have itself S/N.
FG ID defined as Primary Key and auto increment, S/N is UNIQUE.
I want the system can make looping and continually generate S/N number from start number, looping is based on the quantity if the product is control by S/N. i.e:
Product = 101, quantity=120,
FG ID Product ID S/N lot control lot quantity
1 101 0100 N 1
2 101 0101 N 1
. 101 0102 N 1
. 101 . N 1
. 101 . N 1
. 101 . N 1
120 101 0220 N 1
So, my question:
1. how to write the looping script and generate the S/N?
2. each time looping, the system can direct store the data in databases?
I using PHP 4, MySQL database, Apache Web Server.
Thanks in advance,
molly.
|