mysql - How to insert ISO-8859-1 charset values in DB using php -


i'm inserting contents table bulk upload format (.csv).

in csv columns include special characters server can't insert special characters included rows db , stops execution.

how can insert these values?

i'm trying:

$field1= addslashes(trim($data[0])); 

and i'm using mysqli_real_escape_string, it's working omits special characters fields...

$field2= mysqli_real_escape_string(trim($data[1]));  

do not call conversion routines. declare .csv file encoded latin1. clause in load data statement:

character set latin1 

you have not said charset column/table is. please provide show create table. column can either latin1 or utf8.

also, use mysqli_set_charset establish charset client code using. (it not need same column/table.)

you "omits special characters". mean data stored table(s), strings truncated @ special characters? see "truncated text" in trouble utf8 characters; see not stored .

you "stops execution". seems unlikely; please provide more details, such sql caused termination, whether other commands come run after it, whether needed start (not "restart") mysqld again.

you "special characters"; let's see examples. used escaping $field variables, did variables?


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

php - Need to store a large amount of data in session with CI 3 but on storing large data in session it is itself destorying automatically -