Hi

If somebody can point me in the right direction for what i require that would be great.
I will give an example rather than exactly what i require just to make it simplier to get the information across

1.I have a csv file which has around 400 rows in it with just one colomn eg names (with all different names in each row

2.I have a set sentence eg
my name is $name and i like being called $name and there is nothing i would more like to be called than $name


I would like to replace the $name in the sentence with the names in the csv file and repeat for each one, then print this to make a txt file for an import process

not only this but each row that prints is to be numbered starting from a number of my choice each time


Hope somebody can help please
Thanks in advance

Member Avatar for diafol

http://www.php.net/manual/en/function.str-getcsv.php#99323

for getting an array.

The just use a loop setting $name to the array item in question.

//EDIT

I just saw 'one column' - so it's even easier. It's just a textfile then - no csv?

Perhpas you could explode on '\n' to get the array.

fgetcsv()

Right i have now decided to put the rows into a table in database and run from that.

I have got a fetch array with a loop setting and have now got the result on a webpage all the details i require which is great. over 400 results in about 2 seconds :) just what i wanted.

An html page is not really what i require though so if somebody can help, how i then get the contents of this into a txt file rather than html.

The reason html wont do is because im using the data then to import somewhere else of which needs to be a utf-8 txt file.

Hope you understand what i mean and hope you can help
Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.