I cannot figure out why and I searched the forums for a possible answer, but I am having a brain F@*t here.
I cannot figure out how to successfully process this CSV file and get its contents ready for insertion into a Db
Some items to take into consideration for this CSV file:
Special characters are represented with HTML entity codes (e.g.
° for the degrees symbol). These need to be decoded
Because some fields contain newline characters, they cannot be transferred as-is within a tab-delimited text feed. Therefore all newline characters have been replaced with "=n=". They will need to be replaced with real newline characters before insertion into Oracle
I am doing this so far:
$inputFile = "maxad_march29.csv";
if (file_exists($inputFile))
{
$wholeFile = file($inputFile);
$wholeFile = str_replace('=n=','\n',$wholeFile);
$wholeFile = array_map('html_entity_decode', $wholeFile);
echo '<pre>' . print_r($wholeFile, true) . '</pre>';
exit;
$file = fopen("contacts.csv","w");
foreach ($wholeFile as $line)
{
fputcsv($file,split(',',$line));
}
fclose($file);
}
which right now renders this:
Array
(
[0] => part_no title description headline diagram customer_benefits applications competition_and_sales_strategy competitive_threats_and_counter_measures summary quickview data_sheet_pdf
[1] => DG401 Improved, Dual, High-Speed Analog Switches Maxim's redesigned DG401/DG403/DG405 analog switches now feature guaranteed low on-resistance matching between switches (2 max) and guaranteed on-resistance flatness over the signal range (3 max). These low on-resistance switches (20 typ) conduct equally well in either direction and are guaranteed to have low charge injection (15pC max). The new design offers lower off leakage current over temperature (less than 5nA at +85°C).\n\nThe DG401/DG403/DG405 are dual, high-speed switches. The single-pole/single-throw DG401 and double-pole/single-throw DG405 are normally open dual switches. The dual, single-pole/double-throw DG403 has two normally open and two normally closed switches. Switching times are 150ns max for tON and 100ns max for tOFF, with a maximum power consumption of 35µW. These devices operate from a single +10V to +30V supply, or bipolar supplies of ±4.5V to ±20V. Maxim's improved DG401/DG403/DG405 are fabricated with a 44V silicon-gate process. http://www.maxim-ic.com/quick_view2.cfm?qv_pk=1001 http://pdfserv.maxim-ic.com/en/ds/DG401-DG405.pdf
[2] => DG403 Improved, Dual, High-Speed Analog Switches Maxim's redesigned DG401/DG403/DG405 analog switches now feature guaranteed low on-resistance matching between switches (2 max) and guaranteed on-resistance flatness over the signal range (3 max). These low on-resistance switches (20 typ) conduct equally well in either direction and are guaranteed to have low charge injection (15pC max). The new design offers lower off leakage current over temperature (less than 5nA at +85°C).\n\nThe DG401/DG403/DG405 are dual, high-speed switches. The single-pole/single-throw DG401 and double-pole/single-throw DG405 are normally open dual switches. The dual, single-pole/double-throw DG403 has two normally open and two normally closed switches. Switching times are 150ns max for tON and 100ns max for tOFF, with a maximum power consumption of 35µW. These devices operate from a single +10V to +30V supply, or bipolar supplies of ±4.5V to ±20V. Maxim's improved DG401/DG403/DG405 are fabricated with a 44V silicon-gate process. http://www.maxim-ic.com/quick_view2.cfm?qv_pk=1001 http://pdfserv.maxim-ic.com/en/ds/DG401-DG405.pdf
Each field is seperated by \t or tab dilimented (eg [0] => part_no\t title\t description headline\t)
A sample Data/Drvier file is attached in the zip.
Any help would be appreciated
I am trying to assign the first row as the $rows, example $row[part_no], etc
I hope this make sense, sorry if I am confusing anyone
Thanks
Mike