Thanks for the reply. When I try to print out fields (to test before I'm inserting into the database), php just prints Array. I'm having trouble getting this to work right with fscanf and any fields that include spaces. Example:
This works fine, inserts data in the correct fields, but when a string that has to be inserted has a space, it stops and goes to the next record
while ($import = fscanf ($handle, "%s;%s;%s;%s;%s\n")) {
list($line) = $import;
//Seperate fields from ;
$data = explode(";", str_replace("\"", "", $line));
list ($pin, $bin, $descr, $treat, $let) = $data;
//Insert data
if(!$result = mysql_query("INSERT INTO BRData (PIN, BIN, DESCR, Treatment, LET) VALUES ('$pin', '$bin', '$descr', '$treat', '$let')", $link_id)){
showerror();
}
}
I've tried using explode without the list construct, but that just prints out Array, and having Array in every field of my database is no help 🙂
If someone could answer this question as well as another, that would be a big help.
What datatype does fscanf return? An array or a string? I'm having trouble just printint out the line of text fscanf will get just for testing purposes. That prints out array as well. Thanks for the help,
ben