How to import CSV file into phpmyadmin using PHP?

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.

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


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.