Accents problem when inserting on DB

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Stela
Forum Commoner
Posts: 46
Joined: Tue Aug 12, 2008 12:38 pm

Accents problem when inserting on DB

Post by Stela »

Hello…

I created a form for users to input data on a mysql DB. Accents appear OK on the form, I do a echo before the Query to insert the data on DB and no problem with the accents, but when I go to the DB, those accents inserted by the users don't appear OK.

The tables are UTF8 and everything in PHP is encoded in UTF8.

Where might be the problem?

Thanks.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Accents problem when inserting on DB

Post by Christopher »

You need to set the collation for that table/field to support UTF8 probably.
(#10850)
Stela
Forum Commoner
Posts: 46
Joined: Tue Aug 12, 2008 12:38 pm

Re: Accents problem when inserting on DB

Post by Stela »

I already did that (forget to mention it).

But I think i did it!!!

What I did was to use ut8_encode when establishing a connection, now everything appears OK. The data already inserted there wasn't changed but all the new data appears OK.

Thanks for the answer.
Stela
Forum Commoner
Posts: 46
Joined: Tue Aug 12, 2008 12:38 pm

Re: Accents problem when inserting on DB

Post by Stela »

This is odd.

After inserting a few data, everything was allright, but suddenly the accents on the DB are strange again.

When I put them on a web page they appear OK, but on the DB no.

Is there a problem if they stay like this?
Post Reply