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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.