I use the PDO_ODBC method:
1- Install ODBC on a server that has wamp and enable the PHP_PDO_ODBC extension on your disk
2- Use this code that supports UTF-8:
try{
$hostname = "IP";
$dbname = "database";
$username = "username";
$pw = "password";
$pdo = new PDO ("odbc:Driver={SQL Server Native Client 10.0};Server=$hostname;Database=$dbname; Uid=$username;Pwd=$pw;");
} catch (PDOException $e) {
echo "Failed : " . $e->getMessage() . "\n";
exit;
}
$query = $pdo->prepare("select field_name from table");
$query->execute();
for($i=0; $row = $query->fetch(); $i++){
echo iconv("CP1256","UTF-8", $row['field_name'])."<br>";
}
3- replace these elements with yours:
IP-- --field_name-
4- "SQL SERVER" "SQL Server Native Client 10.0", "IP, " "IP", "ISO-8859-6" "CP1256".