SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to import CSV file into phpmyadmin using PHP?

    Hi
    I am able to import csv data into phpmyadmin using php. However, I am getting an error if csv data contains a text with apostrophe (‘) symbol (e.g. my book’s name is abc).
    Appreciate any suggestions to resolve this error.
    Thank you.

  2. #2
    SitePoint Addict kivison's Avatar
    Join Date
    Dec 2004
    Location
    Whitley Bay, Tyne & Wear, UK
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you use a text editor to find and replace the ' with \' which escapes the character?

    normally php uses addslashes("my book’s name is abc") to turn it into "my book\’s name is abc"

    That will remove the error

    Keith

  3. #3
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Keith,

    Thank you for your suggestion. As I understand you, this can be done with manual intervention for the texts with apostrophes. However, I would like to do this with the program coding such that it can import a text with an apostrophe.


Tags for this Thread

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
  •