Re: [PHP] Importing Data from Text File

2001-04-18 Thread Plutarck
Use file() to read the file up into an array (we'll call it $array). Then I would personally use: foreach ($array as $val) { trim($val); $arr = explode("\t", $val); // "\t" means tab, but it will not work if it's only spaces instead of a real tab $stock_name = $arr[0]; $stoc

Re: [PHP] Importing Data from Text File

2001-04-17 Thread Chris Fry
Chris, What you need to do is read each line of the file into an array: $aryInput = file("/path/filename", "r"); Connect to the Database: $dbh = mysql_connect ("localhost", "user", "password"); if (! $dbh) { print "Error connecting to the Database Engine"; } Select the table: mysql_selec

[PHP] Importing Data from Text File

2001-04-17 Thread Chris Aitken
Hi Everyone, Ive been asked to do a task here at my work and its something ive never done before. I was hoping you guys could point me in the right direction so I can research some more and discover how in the hell im gonna do this :) Basically, I have been issued a TAB delimited text file whi