I’m not sure what I did wrong. The empty table appears correctly. But the data in the db won’t show.
This is my code:
FILE:
luca/grid/index.php
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="STYLESHEET" type="text/css" href="../dhtmlx/dhtmlxGrid_v45_std/codebase/dhtmlxgrid.css">
<script src="../dhtmlx/dhtmlxGrid_v45_std/codebase/dhtmlxgrid.js"></script>
</head>
<body>
<div id="gridbox" style="width:500px;height:400px;"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
//the path to images required by grid
mygrid.setImagePath("/codebase/imgs/");
mygrid.setHeader("Task");//the headers of columns
mygrid.setInitWidths("250,250"); //the widths of columns
mygrid.setColAlign("right,left"); //the alignment of columns
mygrid.setColTypes("ro,ed,ed,ed"); //the types of columns
mygrid.setColSorting("int,str,str,int"); //the sorting types
mygrid.init(); //finishes initialization and renders the grid on the page
mygrid.load("connector.php");
</script>
</body>
</html>
and in the same folder:
luca/grid/connector.php
<?php
require_once("../dhtmlx/dhtmlxConnector_php_v15_120612/codebase/grid_connector.php");//includes related connector file
$res=mysql_connect("here I filled in the 'host name' of my MySQL db on my server","here I filled in the db username","here I filled in the db password"); //connects to server containing the desired DB
mysql_select_db("here I filled in the db name"); //connects to DB.'sampledb' is the name of our DB
$conn = new GridConnector($res,"MySQL"); // connector initialization
$conn->render_table("todolist","ID","Task"); // 'todolist' is the table name.
?>
Can anyone help me out? Cheers!