Grid - Server side Tutorial

Hi there,

I´ve been fighting with the grid Server side tutorial for a couple of hours and I can´t get the grid connector to work. I followed the step-by-step-tutorial to the letter, but I still can´t Display any data. If I try to access the mysql database via php everything works fine…

So here is the code form my index.html:


Basic Grid
dhtmlxEvent(window,"load",function(){ mygrid = new dhtmlXGridObject("mygrid_container"); mygrid.setImagesPath("codebase/imgs/"); mygrid.setHeader("Name,Quantity,Price"); mygrid.setInitWidths("*,150,150"); mygrid.setColAlign("left"); mygrid.setColTypes("ed,ed,price"); mygrid.setSkin("material"); mygrid.setColSorting("str,int,na"); mygrid.init(); mygrid.load("data2.php");

and from data2.php:

<?php require_once("codebase/connector/grid_connector.php");//includes connector file $res=mysql_connect("localhost","test","test");//connects to server with db mysql_select_db("sampledb");//connects to the database with the name "sampledb" $conn = new GridConnector($res); //initializes the connector object $conn->render_table("books","id","title,quantity,price"); ?>

The Login credentials are fine - as I said getting the data via php is not a problem at all. I don´t know if it´s important, but I am using as my playground. I hope this is not an issue with codeanywhere…

Any advice on what I am doing wrong?

Thanks in advance,


Please. try to use the latest package of the dhtmlxConnector:
If the problem still occurs please, check the logs in the browser.

I tried the latest connector from github. Unfortunately it still doesn´t work. Also I don´t get any errors in the browser - it just renders an empty table, complete with headers and Buttons, but without data.

I trid to enable logging by adding

$conn->enable_log("connector/temp.log", true);

to my data.php. But this doesn´t Change anything. No log is generated. The complete data.php Looks like this:

<?php require_once("connector/grid_connector.php"); $res=mysql_connect("localhost","test","test"); mysql_select_db("sampledb"); $conn = new GridConnector($res); $conn->enable_log("connector/temp.log", true); $conn->render_table("books","id","title,quantity,price"); ?>

Anymore hints on what I am doing wrong?

Please, provide a response from your “data2.php” request.

I am getting a HTTP 500 Error. But I don´t get why the Connections times out…

Hi , in my case i’m using sqlserver and i’ve found a solution:

In data.php file i’ve included this line:

Maybe in your case you need to add db_mysql.php ?