Array Question

# Thread: Array Question

1. Senior Member
Join Date
Dec 1969
Posts
661

## Array Question

&nbsp;<BR>Hi,<BR><BR>I want to pass information from one page to another, then take this data and pass it to an array, then display the array<BR><BR>&#060;%<BR>PageHitsTemp = request.form("PageHitsTemp")<BR><BR>&#039; here is what is passed<BR>PageHitsTemp = "4621,1189,1168,1124,1070,1067,1039,987,909,761,75 9,756,755,754,753,747,689,678,634,618,614,598,571, 569,554,553,524,520,487,487,484,482,482,468,442,44 1,433,429,424,423"<BR><BR>PageHits = Array (PageHitsTemp) <BR>Counter = 1<BR><BR>For i = 0 to UBound(PageHits)<BR>Response.Write PageHits(i) & "<BR>"<BR>Response.Write Counter<BR>Counter = Counter + 1<BR>Next<BR>%&#062;<BR><BR>The result is this:<BR>4621,1189,1168,1124,1070,1067,1039,987,90 9,761,759,756,755,754,753,747,689,678,634,618,614, 598,571,569,554,553,524,520,487,487,484,482,482,46 8,442,441,433,429,424,423<BR>1<BR><BR><BR><BR>The problem is that the array sees the array as only one element.<BR><BR>ideas?<BR><BR>Paul

2. Senior Member
Join Date
Dec 1969
Posts
6,476

## RE: Array Question

PageHits = SPLIT(PageHitsTemp, ",") <BR>Counter = 1 <BR><BR>For i = 0 to UBound(PageHits) <BR>Response.Write PageHits(i) & "&#060;/br&#062;" <BR>Response.Write Counter <BR>Counter = Counter + 1 <BR>Next <BR>

3. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Out of curiosity

What are you doing?? why do you even need an array, you want all the data to be displayed as is so why do you want an array??<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
96,118

## I'm with you...

What&#039;s the point of converting it to an array?<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
6,476

## RE: I'm with you...

His code is trying to write them out individually with a line break.<BR>value &#060;/br&#062;<BR>value2 &#060;/br&#062;<BR>etc...<BR><BR>Hes just saying what happening with his existing code, its returning val,val2,val3 etc...<BR>It wasnt going into an array as he thought it was.<BR><BR>At least thats how I read it?

6. Senior Member
Join Date
Dec 1969
Posts
661

## part of a recordset

&nbsp;<BR><BR>The array is used as a column a recordset. It is sort off hard to explain but I got it working.<BR><BR>Paul

7. Senior Member
Join Date
Dec 1969
Posts
96,118

## Hmmm...okay...

I just figured that was his doing some debugging.<BR><BR>But if he wants the line breaks, then why not:<BR><BR>Response.Write Replace( Request("whatever"), ",", "&#060;br/&#062;" )<BR><BR>Presto?<BR><BR>

8. Senior Member
Join Date
Dec 1969
Posts
661

## ok... rest of the story

&nbsp;<BR>One page has this array and another. They always have 40 things. It is hard coded.<BR><BR>I pass these along with an email address in a hidden field in a form.<BR><BR>One of the arrays (really a string) is passed to an SQL statement that brings up a recordset. This record set is displayed along with one of the arrays. There are 40 records.<BR><BR>This is then turned into .txt file delimintaed with &#124<BR>and mailed to a email address specifeid on the form on the first page.<BR><BR>It works.<BR><BR>Now you know why I gave you just a small portion.<BR><BR>thanks... <BR><BR>; - O

9. Senior Member
Join Date
Dec 1969
Posts
6,476

## I hope your not

Doing what I think your doing...<BR><BR>This array, does it hole ID numbers of records in database?<BR><BR>Are you looping the array, and with each loop, grab the value and query the database to get the record?<BR>Meaning 40 hits to database?<BR><BR>IF So, then YUCKKKKK<BR>If not, then please forgive me...<BR><BR>If this is what your doing, you can pass your comma delimited list of numbers to your query like this<BR><BR>Select whatever From tableName Where ID IN(111,232,333,434,232)<BR><BR>That will return only those records...<BR>Hoping this helps...<BR><BR>Again if im way off please forgive me...<BR>Just trying to save you from disaster....<BR><BR>Im heading out now, so if further help is needed others will help im sure...<BR>

10. Senior Member
Join Date
Dec 1969
Posts
259

## RE: Array Question

arrWhatever = split(PageHitsTemp,",")

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•