fill dhtmlx-Grid with data from mySQL-Table

Hi everbody,
I have a problem: I want to fill a dhtmlx-Grid with data from a mySQL table. I read the tutorials from the dhtmlx-site and I have done all as it stand there in the tutorial, but it doesn’t work …

I use xampp. I have downloaded dhtmlx-Suite and also php-connector.

this is my little code for the Grid.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>index.html</title>
<link rel="STYLESHEET" type="text/css" href="dhtmlxGrid/codebase/dhtmlxgrid.css">
    <script src="dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
    <script src="dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
    <script src="dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
    <script src="dhtmlxtest.js"></script>
    <script src="dhtlmxConnector/codebase/connector.js"></script>
    <script>
      var grid;
      function doInit(){
          grid = new dhtmlXGridObject('my_container');
          grid.setHeader("contact_id,fname,lname,email");
          grid.setSkin("modern");
          grid.setColAlign("center,center,center,center");
          grid.setInitWidths("100,100,100,150,*");
          grid.init();
          grid.addRow(1,"1,Sarah,Entwicklung,sarah@sarah.de",1);
          grid.setColTypes("ro,ro,ro,ro");
          grid.load("../contacts.php");
        }
    </script>
</head>
<body onload="doInit()">
<div id="my_container" style="width:500px;height:100px;"></div>
</body>
</html>    

and this is the PHP code with the mySQL connection:

<html>
<body>
<?php
    require("../codebase/connector/grid_connector.php");
    $res=mysql_connect("localhost","root","");
        mysql_select_db("contacts");
 
    $gridConn = new GridConnector($res,"MySQL");
    $gridConn->render_table("contacts","contact_id","fname,lname,email");
?>
</body>
</html>

Can me help someone and can say me what I do wrong that no connection can be build. I can’t fill the table in the browser. Maybe I have some files in the wrong folder?

Thank you very much :slight_smile:

Check if your connector php file gets linked properly.
→ grid.load("…/contacts.php");
You can do so by looking at the source code in your browser and check the link.
2)
You don’t need html and body tags in the connector php file
3)
Make you sure filled in the correct host, login and pass details in:
$res=mysql_connect(“localhost”,“root”,"");
4)
try changing the " to a ’ like this:
$res=mysql_connect(‘localhost’,‘root’,‘pass’);
5)
make sure you filled in the correct ‘Database-name’. Isn’t ‘contacts’ your table name?
mysql_select_db(“contacts”);
6)
Make sure the grid_connector.php file is linked correctly. You can do so by looking at the PHP error logs, usually in the root directory of your server.
require("…/codebase/connector/grid_connector.php");