# Loop array question

**URL:** <https://forum.kirupa.com/t/loop-array-question/223136>\
**Category:** flash\
**Created:** [April 19, 2007, 8:51pm UTC](https://forum.kirupa.com/t/loop-array-question/223136 "2007-04-19T20:51:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [April 19, 2007, 8:51pm UTC](https://forum.kirupa.com/t/loop-array-question/223136/1 "2007-04-19T20:51:18Z")

</div>

I’m having a problem here. I have 2 dynamic arrays (which for the times being I hard coded values to).

```auto

split_location = new Array ('ShopCartID', 'FirstName', 'LastName');
total_split_text = new Array ('test31234567', 'Dave', 'Collier', 'test31234567', 'Angela', 'Ponte');

```

What I need to do is dynamically build a SQL statement that will insert total\_split\_text into the total\_split\_location.

The final output should be the following

```auto

Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Dave,Collier,);Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Angela,Ponte,)

```

Don’t worry about the extra comma’s etc - that’s easy enough to get rid of

The current loop I am working with is

```auto

for (i = 0; i < split_location.length; i++) {
    column += split_location* + ",";
    row += total_split_text* + ",";
}

```

The output is

```auto

Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Dave,Collier,)

```

No matter what I do I can’t get the desired output - I can get duplicate outputs of either

```auto

Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Dave,Collier,);Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Dave,Collier,)

```

Or

```auto

Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Angela,Ponte,);Insert Into MailingList (ShopCartID,FirstName,LastName,) Values (test31234567,Angela,Ponte,)

```

Any help is highly appreciated.

-D
