Code Comments
Programming Forum and web based access to our favorite programming groups.Hi I really dont know where to start, so if you could point me in the right direction, tutorial or actual script it would help so much :) I need something that will read every line of a text file read the text before the * and after the start, then put it in a table in the database ie: read question*answer put to database ID QUESTION ANSWER thank you so much if you can help :) - Will ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums
Post Follow-up to this message> PERL is your friend here.
>
>
This is a PHP site :blink:
To read the file into an array, use file() function.
You can the process each line, splitting at the * like this
--------
data = file('myfile.txt');
foreach (data as line) {
_ _list (q, a) = explode('*' ,
trim(line) );
_ _mysql_query("INSERT INTO mytable (question,
answer) VALUES ('q',
'a')";
}
--------
Make the ID field auto_increment.
hth
Barand
http://members.aol.com/barryaandrew...agridguide.html easy
data tables - and more
----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.