简体   繁体   English

Microsoft SQL Server驱动程序的odbc连接字符串

[英]odbc connection string for microsoft sql server driver

how to set utf8 chaset for this connection? 如何为此连接设置utf8 chaset? i use code below : 我使用下面的代码:

<meta charset="utf-8">
<?php
$connection = odbc_connect("Driver={SQL Server};Server=MGHZA\MSSQLSERVER2012;      Database=test_db;", "sa", "mghza");
$query = "SELECT * FROM t1"; 
$res = odbc_exec($connection,$query); 

while( $row = odbc_fetch_array($res) ) { 
    print_r($row); 
} 
?>

and when i run the page , will see below text: 当我运行该页面时,将看到以下文本:

Array ( [id] => 2 [fname] => ���� [lname] => ����� ) 

i save persian characters in my database 我将波斯字符保存在数据库中

试试这个

 print_r(utf8_decode($row));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此扩展需要PHP中用于SQL Server的Microsoft ODBC Driver 11 - This extension requires the Microsoft ODBC Driver 11 for SQL Server in PHP 如何在 Elastic Beanstalk 上为 SQL 服务器安装 Microsoft ODBC 驱动程序 - How to Install Microsoft ODBC Driver for SQL Server on Elastic Beanstalk 为 Microsoft SQL 服务器安装 ODBC 驱动程序和 php 驱动程序 ZA5C95B86291EA2709FCBE64458ED 服务器 - Install ODBC driver and php drivers for Microsoft SQL Server for Laravel Sail SQLSTATE[08001]:[Microsoft][ODBC Driver 13 for SQL Server]TCP Provider:无法建立连接,因为目标机器主动拒绝它 - SQLSTATE[08001]: [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it 连接池不适用于SQL Server for Linux的ODBC驱动程序13 - Connection pooling not working with ODBC Driver 13 for SQL Server for Linux PHP PDO Microsoft SQL Server:SQLSTATE [24000]:[Microsoft] [用于SQL Server的ODBC驱动程序11]-无效的游标状态 - PHP PDO Microsoft SQL Server: SQLSTATE[24000]: [Microsoft][ODBC Driver 11 For SQL Sever] - Invalid Cursor State 42000 [SQLSTATE] [Microsoft] [用于 SQL 服务器的 ODBC 17 驱动程序] [SQL Server] 无法打开数据库“ - 42000 [SQLSTATE] [Microsoft] [ODBC 17 driver for SQL Server] [SQL Server] It is not possible to open the database " [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]在 Laravel 中使用 model::with 时转换失败 - [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Conversion failure when using model::with in Laravel SQLSTATE [42000]:[Microsoft] [用于SQL Server的ODBC驱动程序13] [SQL Server]&#39;`&#39;附近的语法不正确 - SQLSTATE[42000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near '`' 此扩展需要 Microsoft ODBC Driver 13 for SQL Server 才能与 SQL Server 通信 - This extension requires the Microsoft ODBC Driver 13 for SQL Server to communicate with SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM