469,926 Members | 1,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

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,WEBSITE,CA,Book,25.95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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,WEBSITE,CA,Book,25.95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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 2382
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,WEBSITE,CA,Book,25.95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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,WEBSITE,CA,Book,25.95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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*****@firstdbasource.com> wrote in message
news:ry*****************@newssvr24.news.prodigy.co m...
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,WEBSITE,CA,Book,25.95,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,???
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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,WEBSITE,CA,Book,25.95,1
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,CA,Poster,10.00,2
CalJoe33,18,08/23/2004,FED EX,PREPAID,WEBSITE,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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Paul C-T | last post: by
7 posts views Thread by Jefferis NoSpamme | last post: by
8 posts views Thread by duncan.lovett | last post: by
14 posts views Thread by Roland Hall | last post: by
reply views Thread by Simon Gare | last post: by
109 posts views Thread by jmcgill | last post: by
8 posts views Thread by TXpugslave | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.