Results 1 to 4 of 4

 

Thread: Strange bug with Affordable Mobiles and Tesco Mobile feeds

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Mar 2008
    Location
    UK & Australia
    Posts
    45
    Thanks
    2
    Thanked 3 Times in 3 Posts


    Noticed a strange bug with my scripts to split the CSV files from Affordable Mobiles and Tesco feeds and put them in to a database the other day.

    I am using PHP's fgetcsv command to extract the fields from the CSV file that I want and put them in to the database.

    The strange behaviour is that when I get the data for the free gifts and it contains a double quote in it, then the double quote gets moved to the end of the string - i.e.

    The CSV file contains a field with:
    Toshiba 26" LCD TV

    When this is extracted using fgetscv and ends up in my database the " has moved to the end and it looks like this:

    Toshiba 26 LCD TV"

    If anyone has come across this in PHP before or your feeds have been playing up please let me know.

    Thanks.

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Mar 2008
    Location
    UK & Australia
    Posts
    45
    Thanks
    2
    Thanked 3 Times in 3 Posts
    If you want to check the code, I have stripped it down to the most basic elements I can:

    Code:
    $handle = fopen("affordable.csv", "r");
    	
    while (($data = fgetcsv($handle, 4096, ',', '"')) !== FALSE) {
      echo $data[0];
    }
    where the CSV file contains just:
    "Toshiba 26" LCD TV"

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    160
    Thanks
    4
    Thanked 7 Times in 6 Posts
    Quote Originally Posted by Powerup View Post
    If you want to check the code, I have stripped it down to the most basic elements I can:

    Code:
    $handle = fopen("affordable.csv", "r");
    	
    while (($data = fgetcsv($handle, 4096, ',', '"')) !== FALSE) {
      echo $data[0];
    }
    where the CSV file contains just:
    "Toshiba 26" LCD TV"
    If the double quotes is not after a comma then I would suggest changing it to be:
    PHP Code:
    &quot
    If you're not sure how to do this then let me know.

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Mar 2008
    Location
    UK & Australia
    Posts
    45
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Hi Jamie,
    Thanks for the replies.

    Do you mean something like str_replace:
    Code:
    echo str_replace('"', '"', $data[0]);
    I tried that but I just end up with:

    Toshiba 26 LCD TV"

    Also something like:
    Code:
    echo mysql_escape_string($data[0]);
    Gives me Toshiba 26 LCD TV\"



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Beepy and Affordable mobiles feeds at affiliatefutue
    By gssodhi in forum Affiliate Future
    Replies: 3
    Last Post: 28-10-08, 09:36 AM
  2. Mobiles.co.uk Publish/Data Feeds
    By rich_crid4 in forum Mobile, Broadband & Internet Services
    Replies: 0
    Last Post: 10-09-08, 09:21 AM
  3. New Merchant: Affordable Mobiles
    By Ryan Gilbert in forum Webgains
    Replies: 0
    Last Post: 20-02-08, 03:21 PM
  4. Tesco Contract Mobiles launches exclusively with Affiliate Window!
    By Keltie Gower in forum Affiliate Window & buy.at
    Replies: 0
    Last Post: 16-08-07, 12:19 PM
  5. Tesco launches own-brand mobiles
    By zaq in forum Affiliate Marketing Lounge
    Replies: 18
    Last Post: 06-05-03, 05:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2