I'm using the code below to upload a CSV Data import directly into my website. I've written this to alleviate the need to process the import via phpMyAdmin using the csv import - so that others can upload the files without the need to back-room access.
However, I'm finding that my import routine has a sensitivity to 'special characters' in php so for example if one of the records contained a delivery from "St John's Ambulance" the ' in the wording "John's" would cause the whole row to be rejected. This is also true for trialling spaces and the following characters " ' \ ` / ( ) +.
How, do I dial down the sensitivity in this regard for field that maybe contain such characters or should it be this way - I know that in phpMyAdmin you can always check the box that states "Do Not Abort on Insert Error" which over-rides these errors.
Can you do the same in the import file?
$file = $_FILES['file']['tmp_name'];
$handle = fopen($file,"r");
// fgets = misses the header row.
while(($fileop = fgetcsv($handle,10000,",")) !== false)
$dateOfInvoice = $fileop;
$dateOfPurchaseOrder = $fileop;
$poNumber = $fileop;
$supplier = $fileop;
$supplierNumber = $fileop;
$dateOfBookingIn = $fileop;
$SKU = $fileop;
$supplierPCode = $fileop;
$supplierDesc = $fileop;
$unitsRequired = $fileop;
$cartonsSize = $fileop;
$cartonsRequired = $fileop;
$qtyReceived = $fileop;
$receiptedBy = $fileop;
$dateSysUpdated = $fileop;
$comments = $fileop;
$query1 = "INSERT into goodsIn
$result = $mysqli->query($query1);