Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2004, 10:13 PM
Authorized User
 
Join Date: Apr 2004
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default 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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping ssaranam SQL Server 2005 2 April 17th, 2008 01:40 AM
looping mrjoka Classic ASP Basics 1 September 26th, 2007 12:21 AM
Looping deepsea007 XSLT 1 June 14th, 2007 12:13 PM
XSLT Looping Logic - Very Urgent ujayaraman XSLT 2 March 3rd, 2005 10:42 AM
Looping..? dedex C# 2 January 6th, 2005 11:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.