Using PHP Grid control with MSSQL

QuestionsUsing PHP Grid control with MSSQL
Arne asked 6 years ago

Hi,
I've just bought the premium version of Grid Control and want to use it with my Microsoft SQL database. Not MySQL server.

So how to start? The database.sql is not for MS SQL so to run, what to do?

just the quick start…
🙂

10 Answers
Abu Ghufran answered 6 years ago

Hello,

Try the sample in demos/loading/db-layer-sqlsvr.php

Just change your database config and table/sql settings. For more customizations, refer docs and other demos on website.

Arne answered 6 years ago

Fantastic!
🙂

It worked!
Thank you for responding me so fast!
This looks very nice!

mike answered 6 years ago

when I go to the suggested link I get an error on your page mssqlnative extension not installed

Abu Ghufran answered 6 years ago

This was because, sqlserver is not installed on our server.
I just disabled those demos online. It is tested on local environment and sql server works fine by just changing db conffig.

mike answered 6 years ago

Sorry if you found an inbox full of my updates, but being in eastern US I think we are are different time frames. Getting closer but still can't get it to work.
I get the following error when $out = $g->render("list1"); is in my code.
Couldn't execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[pltdata].[dbo].[CustomerMasterTable] WHERE 1=1 LIMIT 1 OFFSET 0' at line 1 – SELECT * FROM [pltdata].[dbo].[CustomerMasterTable] WHERE 1=1 LIMIT 1 OFFSET 0
This is what I have.
$db_conf = array();
$db_conf["type"] = "mssqlnative"; // or mssql
$db_conf["server"] = "SQLSERVER";
$db_conf["database"] = "Pltdata";
$g = new jqgrid($db_conf);
// include and create object
include("inc/jqgrid_dist.php");
$g = new jqgrid();
// set few params
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
// render grid and get html/js output
$g->table = "[pltdata].[dbo].[CustomerMasterTable]";
$out = $g->render("list1");

mike answered 6 years ago

still can't figure out what is giving me this error. I assume I missed a setting somewhere in the config

Abu Ghufran answered 6 years ago

I guess, the issue is with
$db_conf["server"] = "SQLSERVER";
It should be your instance name OR it could be IP:port

I've also emailed you few samples for connection.

ManUtd answered 2 weeks ago

Can anyone help me to fix this error.

Please check your database connection configuration. SQLState: IMSSP Error Code: -1 Message: Invalid option was passed to sqlsrv_connect. SQLState: IMSSP Error Code: -1 Message: Invalid option was passed to sqlsrv_connect.

Abu answered 2 weeks ago

You can check these.

Error Connecting to SQL Server 2008

https://stackoverflow.com/a/43089408/385377

 

Abu answered 2 weeks ago

Response from last customer, logging to help others.

Db connection was bcz it was not able to read .env file in laravel. Fixed after giving permission.

Your Answer

8 + 15 =

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?