0

I'm trying to fetch data from my DB.
It works great when there are no hebrew chars involved, but it doesn't work with hebrew chars.
Here's a query for example:

while (list($ddd, $ccc) = each($dbb)){
$dsn = "DRIVER={SQL Server}; SERVER={$ccc};UID={$usr};PWD={$pwd}; DATABASE={$ddd}";
$db->Open($dsn);
$SQL = "SELECT TOP 10 CardCode FROM dbo.OPDN WHERE Cast(CardCode AS Nvarchar(max)) = N'רונלייט'";
$rs = $db->Execute($SQL);
$qqqw='';
while(!$rs->EOF){
    echo ($rs->Fields['CardCode']);
    echo "<br />";
   $rs->MoveNext();
}
$rs->Close();
$db->Close();
}

Help would be highly appreciated.

Nir Tzezana
  • 2,275
  • 3
  • 33
  • 56
  • Try passing the value as a parameter (that's a good idea for a number of reasons, and in this case, prevents multiple-encoding). Have you tested whether the SQL can contain unicode values at all? I assume even `SELECT N'רונלייט'` will return garbled data. – Luaan Mar 26 '14 at 09:50
  • = N'רונלייט' what is the N in front of the Hebrew? should it be there or inside of ''? – mahatmanich Mar 26 '14 at 09:51
  • the N should be outside of the Hebrew, it's for unicode – Nir Tzezana Mar 26 '14 at 09:53

1 Answers1

0

Got it!
Problem was with the file encoding.
It should have been in "ASCI".

Nir Tzezana
  • 2,275
  • 3
  • 33
  • 56