close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Changing collation of database tables?

Thread began 1/04/2011 4:21 pm by henrik.schlegel400884 | Last modified 1/11/2011 10:47 am by henrik.schlegel400884 | 4673 views | 18 replies |

Henrik

Changing collation of database tables?

Some characters of product names and discriptions will not be correctly displayed on my pages, like ü, ö, ä etc. I guess this has to do with the collation used in the database.
(Because on other parts of my pages this characters display correctly!)

I tried to change the collation to utf-8 but can't find how to change the collation of a whole table. ? (The collation of the tables seems to be still in "latin1_swedish_ci".)

I changed the collation in every column of the products table to utf-8 but that didn't solved the issue.

I have attached two screenshots for better understanding.

Could someone please give me a hint how to change the collation of the whole tables ?
If that would solve the issue ... Or any other suggestions ?

Thanks a lot!!

I use:
phpMyAdmin - 2.11.9.6
MySQL-Client-Version: 5.0.88

Sign in to reply to this post

Ray BorduinWebAssist

ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;

Sign in to reply to this post
Did this help? Tips are appreciated...

Henrik

Thank you!

Where should I enter this line?

Sign in to reply to this post

Ray BorduinWebAssist

Usually in the query window of your database manager program.

Sign in to reply to this post
Did this help? Tips are appreciated...

Henrik

I entered this and yes, it changed the collation of the table.

But name and discription of my products still not display correctly.

I 've set the following collation setting in the database to: utf8_general_ci :

- collation of table columns
- collation of tables
- collation of the MySQL connection

My pages are set to:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

But still it doesn't work!

Could the problem be in the server variables and settings?
(See screenshot)

Thanks for the help!

Sign in to reply to this post

Ray BorduinWebAssist

Are you using WebAssist's dynamic connections? It allows you to set the language for your connection... if not you can add it manually to your connection file:


mysql_set_charset('utf8',$YourConnection);

Sign in to reply to this post
Did this help? Tips are appreciated...

Henrik

No, I have to add it manually ...

In the last line of the php code of the connection file ?

If I do that I get a Fatal Error: Call to undifined function

Where exactly I have to enter that?
Thanks!

Sign in to reply to this post

Ray BorduinWebAssist

I think it might be php 5+, so I'm not sure what you would do for php 4, which is probably what you are using if you get a function undefined error. I'd update to php 5 if you can... otherwise you can try defining it:


<?
if (!function_exists('mysql_set_charset')) {
function mysql_set_charset($charset,$dbh)
{
return mysql_query("set names $charset",$dbh);
}
}
?>

Sign in to reply to this post
Did this help? Tips are appreciated...

Henrik

The php version on the server should be 5, I found a note that the server is updated to this versions:

mysql (Version 5.0.88)
php (5.0.11)

---

I changed the code of the connection file matching the following, but got an error/warning: (I am not sure if it was this what you suggested) ?


<?
if (!function_exists('mysql_set_charset')) {
function mysql_set_charset($charset,$mysql_soma)
{
return mysql_query("set names $charset",$mysql_soma);
}
}
?>
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_mysql_soma = "--removed--";
$database_mysql_soma = "--removed--";
$username_mysql_soma = "--removed--";
$password_mysql_soma = "--removed--";
$mysql_soma = mysql_pconnect($hostname_mysql_soma, $username_mysql_soma, $password_mysql_soma) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_set_charset('utf8',$mysql_soma);
?>


Because I got this warning, maybe I did something wrong ...
In this case could you please correct this code?
Thanks!

Sign in to reply to this post

Ray BorduinWebAssist

What was the warning/error?

I guess that function wasn't introduced until version 5.2.3

function.mysql-set-charset.php

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...