Jump to content

Quotes in TXT file .. how to ignore?


nimzie

Recommended Posts

Hi, as my subject says, this is likely something I should be aware of. A simple import script which is something like:

 

        
for($i=1; $i<sizeof($fcontents); $i++) { 
  $line = trim($fcontents[$i]); 
  $arr = explode( $delim , $line); 
  $arr = explode( "\t" , $line); 

  $sql = "insert into origin ( StoreID, OrderID, OrderNumber, OrderDate, IpAddress, Currency, CustomerID, BillFirstName,
                                     BillLastName,BillEmail,BillPhone,BillFax,BillCompany,BillAddress,BillCity,BillState,BillCountry,
                                     BillZIP,ShipFirstName,ShipLastName,ShipEmail,ShipPhone,ShipFax,ShipCompany,ShipAddress,ShipCity,
                                     ShipState,ShipCountry,ShipZip,Status,Comments,ShippingMethod,ShippingCost,ShippingTaxes,HandlingCost,
                                     ShippingDate,DeliveryDate,ValidationCode,PaymentMethod,PaymentCost,Coupon,AddOns,AddonValues,PaymentTaxes,
                                     CardNumber,CardName,CardExpiry,TransactionDate,PreAuthNumber,AuthNumber,ReferenceNumber,Questions,ShortQuestions,
                                     ItemID,ItemName,ItemCode,ItemType,Options,OptionCode,Quantity,ItemPrice,Taxes,Width,Length,Height,LengthUnit,
                                     Weight,WeightUnit,Language ) values (' " . implode ( "','" , $arr) . "')"; 

 

One of the fields contained "Mary's store". It failed the SQL Statement.

 

Can anyone share some tips on how to get around this?

 

Thanks.

Adam

Link to comment
https://forums.phpfreaks.com/topic/93175-quotes-in-txt-file-how-to-ignore/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.