| Index
» Projects
» phpMyEdit
» Forum
» using [SET NAMES] |
 |
atara
Joined: 09 Jul 2009
Posts: 3
Posted: 2009-07-09 14:11
Back to top
Reply with quote
|
In my DB there are some fields in Hebrew. When reading them using PHP I use
| Code: |
SET NAMES "hebrew";
. . . query code . . .
|
I tried to show\change Hebrew fields using -
| Code: |
$opts['fdd']['fieldName']['sql'] = 'SET NAMES "hebrew"; TRIM(fieldName)';
|
but it does not work.
Any hints are welcomed!
Atara
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-07-09 22:02
Back to top
Reply with quote
|
"Approximately" following the example below, you will instead need to hack the class file where the connection is actually made. Search using your text editor in the class file for "function execute" and add your code there.
| Code: |
// existing line
if ($this->connect() == false) { return false; }
// new UTF8 connection.
if(!@mysql_query('SET NAMES UTF8')){ error(mysql_error()); }
if(!@mysql_query('SET COLLATION_CONNECTION=UTF8_GENERAL_CI')){ error(mysql_error()); } |
|
sagiben
Joined: 27 Jan 2009
Posts: 15
Posted: 2009-07-10 07:43
Back to top
Reply with quote
|
I'm using PME with Hebrew, and had to make the following changes in order to display Hebrew content.
1. For each table I defined :
| Code: |
$opts['language'] = 'HE-IL-UTF8';
|
2. At the beginning of each html page I put :
| Code: |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
3. Added the following lines at the end of sql_connect function
| Code: |
if(!mysql_query("SET NAMES hebrew",$this->dbh))
die('Could not set hebrew' . mysql_error());
|
Sagi
|
atara
Joined: 09 Jul 2009
Posts: 3
Posted: 2009-07-12 08:19
Back to top
Reply with quote
|
Thanks, we will try it.
Atara
|
atara
Joined: 09 Jul 2009
Posts: 3
Posted: 2009-07-12 10:49
Back to top
Reply with quote
|
Here are the changes I made:
1. In the page:
1.1
| Code: |
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1255">
instead of -
charset=iso-8859-1"
|
1.2
| Code: |
$opts['language'] = 'HE-IL';
instead of -
//!! $opts['language'] = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
|
2. In phpMyEdit.class.php, function connect(), at the end of the function, I added :
| Code: |
$query = 'SET NAMES hebrew';
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('could not set hebrew ' . mysql_error(), $query);
return false;
}
// else continue -
return true;
} /* end of function connect() */
|
|
|
Post new topic
Reply to topic
|
|
|
|