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:
[code]
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"); });
</script>
[/code]
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 codeanywhere.com as my playground. I hope this is not an issue with codeanywhere…
Any advice on what I am doing wrong?
Thanks in advance,
Chili_666