I am attempting to use a sample PHP script to connect to a Mysql database which has been pre-populated with the dump.sql data. When I enable logging in the PHP script the XML returned is empty with only “<?xml version='1.0' encoding='utf-8' ?>” and I get the following error message in the log:
SELECT item_id
,item_nm
,item_cd
FROM countries
mysql_query() expects parameter 2 to be resource, boolean given at /var/www/html/dhtmlx/dhtmlxConnector/codebase/db_common.php line 916
mysql_fetch_assoc() expects parameter 1 to be resource, null given at /var/www/html/dhtmlx/dhtmlxConnector/codebase/db_common.php line 926
Done in 0.00042295455932617s
Here is the PHP script
<?php require_once("config.php"); require("dhtmlx/dhtmlxConnector/codebase/grid_connector.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); $grid = new GridConnector($res, "MySQL"); $grid->enable_log("test.log",true); $grid->render_table("countries","item_id","item_nm,item_cd"); ?>Here is the html
test <link rel='stylesheet' type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">
<script src='dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
<script src='dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js'></script>
<script src='dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>
<!-- Date: 2012-05-03 -->
</head>
<body>
<div id="gridbox" style=width:632px; height:3870px;"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("column a, column b");
mygrid.setInitWidths("100,*");
mygrid.setColTypes("ed,ed");
mygrid.setSkin("modern");
mygrid.init();
mygrid.loadXML("test.php");
</script>
</body>
----------------------------------------------------------------------------------------
I have validated connectivity to the database via a test php script. Can anyone tell me what I am missing?