Convert db encoding

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
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Convert db encoding

Post by MarK (CZ) »

Hi again :D

I'm trying to convert my db encoding but it seems that the CONVERT function isn't working (or I can't handle it).

This is my SQL query:

Code: Select all

SELECT CONVERT(`text` USING latin2) FROM `news`;
And this is the error returned:

Code: Select all

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING latin2) FROM `news` LIMIT 0, 30' at line 1
What am I doing wrong?? :?
Thx in advance.
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post by jl »

If news is a table name it shouldn't have quotes. If text is a field name it shouldn't have quotes. Wouldn't have thought that would produce that error though, but correct it first.
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

Thx for reply,
actually I've already tested it both with and without 'quotes'. These are grave accents (I'm not sure if they can be called quotes) and they should work around table or column names.

Anyway, the problem remains. Can anyone help? Please!
User avatar
emperor
Forum Newbie
Posts: 16
Joined: Tue Mar 02, 2004 11:20 am
Location: UK

Post by emperor »

Check which version of MySQL you have - the manual sez: "The USING form of CONVERT() is available as of 4.1.0"
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

That's probably the problem (my SQL says 4.0.18-nt), thx for the tip, I'll try to upgrade MySQL server ;)
Post Reply