1,105,447 Community Members

Hebrew String Comparison in MySQL query

Member Avatar
joshisumitnet
Light Poster
26 posts since Jan 2009
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Dear Friends,

I want to know that how can we compare two hebrew string in MySQL database?

I tried and search a lot on net but still could not found the answer.

My website is dealing with Hebrew(main) and English as well.

So please let me know How can I compare these two languages in SQL queries.
Because this problem is became headech for me now. My client is becoming engry and engry and engry..... on me.

Is there any solution for this?

Please help me out.

I am waiting for your reply. Please do it fast as soon as possible.

Thank you in advance.

Joshisumitnet

Member Avatar
smantscheff
Nearly a Posting Virtuoso
1,289 posts since Oct 2010
Reputation Points: 265 [?]
Q&As Helped to Solve: 271 [?]
Skill Endorsements: 8 [?]
 
1
 

Maybe your client gets angry because you promised too much?
Are your tables encoded in UTF? Please submit the table design, some test data and a query which should work but does not.

Member Avatar
joshisumitnet
Light Poster
26 posts since Jan 2009
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

CREATE TABLE IF NOT EXISTS `tblstuff` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'P.K.',
`MemberID` bigint(20) NOT NULL COMMENT 'F.K. Member Table',
`Title` varbinary(255) NOT NULL,
`CategoryID` bigint(20) NOT NULL COMMENT 'F.K. Category Table',
`TagID` bigint(20) DEFAULT NULL COMMENT 'F.K. Tag Table',
`Rate` int(3) DEFAULT NULL,
`Views` bigint(20) DEFAULT NULL,
`Status` enum('A','I','D','L') NOT NULL,
`HomePageStatus` enum('D','N') NOT NULL,
`CreatedDate` date NOT NULL,
PRIMARY KEY (`id`),
KEY `TagID` (`TagID`),
KEY `CategoryID` (`CategoryID`),
KEY `MemberID` (`MemberID`)
) ENGINE=InnoDB DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC AUTO_INCREMENT=136 ;

Member Avatar
joshisumitnet
Light Poster
26 posts since Jan 2009
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

my query is
select Title from tblStuff where upper(convert(Title using latin1)) like '" . addslashes(strtoupper($keyword)) . "%' limit 0,20

I have two languages at one go.Means either Hebrew or English.

Then what to do?
Or let me say that only want Hebrew then what is solutions?
Thanks

Member Avatar
joshisumitnet
Light Poster
26 posts since Jan 2009
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Dear Friends,

Please look at this query...

Select mytext from tblhebrew where mytext='שאלות נפוצות'

When I run this query directly in phpMyAdmin then it's working perfectly.
But when I run same query using php script then it does not working.
Why?
Please see this is my php script code...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="he" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Home Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body>
<?php
$link=  mysql_connect("localhost","root","");
mysql_select_db("dbhebrew");
//mysql_query("insert into tblhebrew (test,description) values ('עדיין לא רשום ? הרשם עכשיו ','עדיין לא רשום ? הרשם עכשיו ')");
$txt="שאלות נפוצות";
$query="Select mytext from tblhebrew where mytext='".mysql_real_escape_string($txt)."'";
echo $query;
$result=mysql_query($query) or die(mysql_error());

$row=mysql_fetch_assoc($result);

echo "output:".$row['mytext'];
?>
    </body>
</html>

Thanks in advance.

Member Avatar
smantscheff
Nearly a Posting Virtuoso
1,289 posts since Oct 2010
Reputation Points: 265 [?]
Q&As Helped to Solve: 271 [?]
Skill Endorsements: 8 [?]
 
0
 

If phpMyAdmin does deliver correct results and your PHP query does not, this is most likely due to the fact that phpMyAdmin issues the correct character set statements. You php script seems to use the wrong character sets.
Have a look at http://dev.mysql.com/doc/refman/5.1/de/charset-connection.html

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: