473,657 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Incrementing Number in Repeat Region - Help!

Tom
Anyone help on this? PHP/MySQL

I have a repeat region displaying records from orders in a CSV format:

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,???

I need to have a column where I can assign each item in the order a
different number incrementally i.e. 1st item = 1, 2nd = 2 etc.

The ??? (last column) in the above records is where I will insert this
incremental number to produce (hopefully):

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,3

Can anyone help me figure out how to add this incrementing number inside
this repeating region? I have a distinct orderID (in this case its 18, 2nd
column) that I can reference from.

Thanks! - Tom
Jul 17 '05 #1
2 2578
Tom wrote:
Anyone help on this? PHP/MySQL

I have a repeat region displaying records from orders in a CSV format:

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,???

I need to have a column where I can assign each item in the order a
different number incrementally i.e. 1st item = 1, 2nd = 2 etc.

The ??? (last column) in the above records is where I will insert this
incremental number to produce (hopefully):

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,3

Can anyone help me figure out how to add this incrementing number inside
this repeating region? I have a distinct orderID (in this case its 18, 2nd
column) that I can reference from.

Thanks! - Tom


First, You really should consider normalizing your data a bit more to REDUCE the
repeated data...

you should have a table with the order innformation.

ID, USER, DATE, CARRIER, SITE, STATE
18, CALJOE

and a data table

ID, ITEM, AMOUNT, ITEM_NUM
18, CD, 24.00, 1
....

and insert the ITEM_NUM from the form data.

or if you just need this for display purposes

loop through the results of the query and add a counter value. I will leave the
code as a learning experience.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Jul 17 '05 #2
Tom
Thanks for the reply,

In this case I'm building an order import CSV for Peachtree Acct. from the
OScommerce store. I can't rewrite the OScommerce tables, so I needed to work
thru it.

Actually the solution was too easy:

$i = 1;
$i ++:

Thanks
"Michael Austin" <ma*****@firstd basource.com> wrote in message
news:ry******** *********@newss vr24.news.prodi gy.com...
Tom wrote:
Anyone help on this? PHP/MySQL

I have a repeat region displaying records from orders in a CSV format:

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,???

I need to have a column where I can assign each item in the order a
different number incrementally i.e. 1st item = 1, 2nd = 2 etc.

The ??? (last column) in the above records is where I will insert this
incremental number to produce (hopefully):

CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Book,25. 95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Poster,1 0.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBS ITE,CA,Video,49 .95,3

Can anyone help me figure out how to add this incrementing number inside
this repeating region? I have a distinct orderID (in this case its 18, 2nd column) that I can reference from.

Thanks! - Tom
First, You really should consider normalizing your data a bit more to

REDUCE the repeated data...

you should have a table with the order innformation.

ID, USER, DATE, CARRIER, SITE, STATE
18, CALJOE

and a data table

ID, ITEM, AMOUNT, ITEM_NUM
18, CD, 24.00, 1
...

and insert the ITEM_NUM from the form data.

or if you just need this for display purposes

loop through the results of the query and add a counter value. I will leave the code as a learning experience.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3140
by: Paul C-T | last post by:
Hi, Is there a way to repeat a set of code until a certain if statement is satisfied. If it is then to exit the loop and if not repeat the code? Say I want to write a card game application in PHP and I want to chose a card from the deck $card1 = rand(1,52); gets me my first card. I need to record which card has been dealt so I have a variable $dealt which starts out as a string of 52 zeros. I update the position of $card1 in the
7
3392
by: Jefferis NoSpamme | last post by:
I don't have a problem laying out a recordset in php/mysql, but each record is returned in a single row in a table file. Is there a way to return say 3 images and descriptions in a 3 column list instead? I mean I'd like the repeating region to be horizontal for three records, e.g., rather than merely one repeating row for each item. Thanks Jeff
8
2647
by: duncan.lovett | last post by:
PHP 4 MySQL 4.0.20 DW MW 2004 7.01 This problem is giving me a bit of a headache, and I'm getting nowhere with it so thought I'd open it up to all, any help would be greatly appreciated. OVERVIEW --------
2
420
by: brian | last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript / JavaScript and also in my favorite text editor: TextPad (www.textpad.com) I don't know about JScript/JavaScript, but in TextPad's implementation of Regular Expressions, you can do a replacement expression like this: \i For every single non-overlapping match, it places an incrementing number starting with zero. Thus, if you searched for ^ (beginning of line...
14
2384
by: Roland Hall | last post by:
Since I'm not getting any response from the community, I'm reposting this under my managed account. I've turned my web.config friendly error messages off and it may be easier to view what I'm experiencing than try to translate it. Here's the error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="netfraud.us.Global" %>
0
1561
by: Simon Gare | last post by:
Hi, I need to calculate a total based on fields in a repeat region, these values are stored in an SQL db, all are numeric and written in ASP. fields are TOTAL_COST VAT GRANDTOTAL (Page selects records based on field parameter and displays in a repeat region)
109
7594
by: jmcgill | last post by:
Hello. Is there a method for computing the number of digits, in a given numeric base, of N factorial, without actually computing the factorial? For example, 8! has 5 digits in base 10; 10! has 7 digits in base 10. Is there a way to compute that information without actually evaluating the factorial?
8
1530
by: TXpugslave | last post by:
And here it is. I'm just, JUST learning how to use perl, and how to do any sort of programming in general. I'm trying to self-teach and have read a book on C programming and wanted to try PERL. I'm really very green at this and don't want to give up, but its not always easy to move forward without help so here goes. I have this simple, simple program that I am trying to write based off of some other examples I have read. Unfortunately, in order...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.