Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving different fields from a file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all, sorry i am realatively new, to the asp world, but can do some pretty good stuff, i am in the middle of creating myself an accounting system,

i have created a simple script to open a txt file, and read the contents, then print the line on the screen, now, the line appears like

9 2001 718 0 72 10651 11 31 718 15

each number corresponds to a different item, the script i have is as follows

****************************************************
<%
set filesy = createobject(&quot;scripting.filesystemobject&quot;)
set txtfile = filesy.Opentextfile(&quot;I:/webalizer/&quot; & name & &quot;/webalizer.hist&quot;,1, 0)
Do
line = txtfile.Readline
%>
<% =line %>
<BR>
<% line=&quot;&quot; %>
<%
Loop until txtfile.atEndofstream
txtfile.close %>

*******************************************************
Now i want to save these results into a database, as single fields, and yea you got it it is a webalizer file, lol
i have tried
allsorts, but cannot seem to get the file to split into different catagories.

can someone please tell me what im doing wrong....
If possible provide the code for the line that is needed, and also provide the variables, to print the information on the screen... For example

<% =test %>
or
<% =script.test %>
or
whatever

thanks



 
Do
line = line & &quot;,&quot; & txtfile.Readline
Loop until txtfile.atEndofstream

dim newArray
newArray = split(line,&quot;,&quot;)

will get your different elements into the elements of the new array, 'newArray', and you can then insert them into your database if you like. Although you could have also done it straight from the text file, as well.

:)
paul
penny.gif
penny.gif
 
i dont understand

the fields are as follows,

month year pages files sites KB unknown1 unknown2 hits visits

how would i set each of the fields into each of these catagories, so that when i need to show them on the screen i can use

<% =month %> which will produce the month value
<% =year %> produce year value,

etc etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top