I am trying to set up a php script that collects a text file from an external ftp server and then imports that text file into a pre-formatted MySql table. When I do this manually via phpmyadmin there is an option available to define the character set of the incoming text file. I need to incorporate that step in the php script and define the character set is iso-8559-1. Following is part of my script that deals with the import - what do I need to add (and where) to define the character set in the same way as in my phpmyadmin?
mysql_select_db("mydatabase_db", $db);
$fileName="/home/mydomain/public_html/ImportsFolder/" . "IncomingFiles-" . $today . ".txt";
$query = <<<eof
LOAD DATA LOCAL INFILE '$fileName'
INTO TABLE filesincoming
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(id,file_url,file_type,file_index,file_caption,file_updated)
eof;
echo "<br />Populated files incoming.";
The script does run OK and imports the text file but it imports it as if character set is utf-8 and this causes some characters to be imported incorrectly into the table (eg a £ sign is imported as a question mark).
Any advice would be much appreciated. Many thanks in advance