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