|
Posted by Vic Spainhower on 11/03/06 23:57
Hello,
I am exporting a table from MS Access which is then imported into a MySQL
table. I am using a TransferText command in Access to export the data to a
TAB delimeted file. Then using the following PHP routine, it is imported
into the MySQL table. One of the fields in the Access data can contain
imbedded CRLF which causes the following code to fail with the error "Column
count doesn't match value count at row 1"
If the last field in the data file doesn't contain an imbedded CRLF the code
works properly. I've tried stripping the CRLF with $line =
trim($fcontents[$i],"\r\n"); but that doesn't work.
Can someone tell me why this doesn't work?
Thanks,
Vic
$fcontents = file ('./'.$facilitiesName);
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode("\t", $line);
$sql = "insert into $tableFacilities values ('".
implode("','", $arr) ."')";
mysql_query($sql);
//echo $sql ."<br>\n";
if(mysql_error()) {
echo mysql_error() ."<br>\n";
}
}
[Back to original message]
|