error using mssqlserver

Questionserror using mssqlserver
Alejandro Cervantes asked 2 years ago

i have an error with gridphp 2.8

$db_conf = array();
$db_conf[“type”] = “odbc_mssql”;
$db_conf[“server”] = “Driver={SQL Server};Server=65.66.168.221;Database=CCCDSSDSDS;”;
$db_conf[“user”] = “sa333”;
$db_conf[“password”] = “CCCC*”;
$db_conf[“database”] = “CCCDSSDSDS”;

when initial loading the page

1 – shows no data only  window error without error text.

2 – on autocomplete if i put this on autocomplete field: JUAN, shows no data only  window error without error text

3 – but if i put  JUAN JOSE on autocomplete field, i works fine.

 

i can see the problem is with special characters like “á é í ó ñ” etc.  when reading sqlserver data

how can you fix it?

 

 

 

 

 

 

 

 

 

3 Answers
Abu Ghufran Staff answered 2 years ago

Hi,

I’d recommend to use latest mssql php driver to connect to sql server. It supports utf8 characters in a much better way.

e.g.1

$db_conf = array();
$db_conf["type"] = "mssqlnative";
$db_conf["server"] = "den1.mssql5.host"; // or ip:port
$db_conf["user"] = 'user';
$db_conf["password"] = 'pass';
$db_conf["database"] = "testdb";

e.g.2

$db_conf = array();
$db_conf["type"] = "mssqlnative"; // or mssql
$db_conf["server"] = "(local)\sqlexpress"; // ip:port
$db_conf["user"] = "";
$db_conf["password"] = "";
$db_conf["database"] = "master";

If you are already using odbc+mssql with special characters, Please send me independent code showing odbc connection setting with php and I’ll send you equivalent code for datagrid.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 2 years ago

Hi,

Just wanted to know if this issue is solved?

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Alejandro Cervantes answered 2 years ago

using this driver

$db_conf = array();
$db_conf[“type”] = “odbc_mssql”;
$db_conf[“server”] = “Driver={SQL Server};Server=65.66.168.221;Database=CCCDSSDSDS;”;
$db_conf[“user”] = “sa333”;
$db_conf[“password”] = “CCCC*”;
$db_conf[“database”] = “CCCDSSDSDS”;

 

Problem solved with your help using this.

$opt[“utf8encode”] = true;

thank you.

Your Answer

20 + 11 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?