Grid with SQL Database Connector

Howdy,

i’m trying to get my DHTMLXGRID to retrieve and send data to my SQL Database using the DhtmlxDataProcessor and the DhtmlxConnector, but eventhough Ive followed the setup guides as closely as I could, i’m simply getting a “Page not found” error when performing an action on my Grid, and nothing is showing up on my Database.

This is a screenshot of the error I get when trying to perform an action ( in this case, adding a Row) :
http://www.kleynan.com/sites/memomed/dataprocessor.png

Am i missing some files? I’ve uploaded the codebases of the Grid, Dataprocessor and Connector packages and this is my index.php file where the grid and processor are initiated:

[code]

//we'll write script commands here var myGrid;
function doInitGrid(){

myGrid = new dhtmlXGridObject('mygrid_container');

myGrid.setImagePath("codebase/imgs/");

myGrid.setHeader("Begreb,Association,Position,Undergruppe");

myGrid.setInitWidths("*,*,*,*");

myGrid.setColAlign("left,left,left,left");

myGrid.setSkin("dhx_skyblue");

myGrid.enableDragAndDrop(true);


myGrid.setColTypes("ed,ed,ed,ed");

	myGrid.init();

myGrid.loadXML("connector.php");

myDP = new dataProcessor("connector.php");
myDP.init(myGrid);

}

function addRow(){
    var newId = (new Date()).valueOf()
    myGrid.addRow(newId,"",myGrid.getRowsNum())
    myGrid.selectRow(myGrid.getRowIndex(newId),false,false,true);
}
function removeRow(){
    var selId = myGrid.getSelectedId()
    myGrid.deleteRow(selId);
}





</script>
[/code]

And my connector.php (with DB info blocked out :wink: )

[code]<?php
require_once(“codebase/grid_connector.php”);

$res=mysql_connect("xxxxxx","xxxxxxx","xxxxxxxx");
mysql_select_db("memomed");

$grid = new GridConnector($res);
$grid->render_table("grid50","item_id","item_nm,item_cd");

?>[/code]

What am I doing wrong? :frowning: Please help!

Kleynan

Edit:** In my connector.php i am also requiring the db_mysql.php file.

require_once(“codebase/db_mysql.php”);

Please help!

require_once(“codebase/db_mysql.php”);
actually it is included automatically, but must not be a problem in any case

This is a screenshot of the error I get when trying to perform an action ( in this case, adding a Row)

a) try to change the order of includes as

<script src="codebase/dhtmlxcommon.js"></script>
<script src="codebase/dhtmlxgrid.js"></script>
<script src="codebase/dhtmlxgridcell.js"></script>
<script src="codebase/ext/dhtmlxgrid_drag.js"></script>

b) double-check that connector.php is really exists in the same folder where html place with the grid is placed.

Okay, i did the changed you said, and it seemed to work, but now when editing a row i get the following error:

Initiating data sending for 1271755456962 Initiating data sending for all rows Sending all data at once Server url: connector.php?editing=true parameters row 1271755456962 marked [updated,valid] Initiating data sending for 1271755456962 Initiating data sending for all rows Sending all data at once Server url: connector.php?editing=true parameters Server response received details Action: error SID:1271755456962 TID:1271755456962 row 1271755456962 unmarked [updated,error]

From my Dataprocessor Debug console. How Can i fix this? Still nothing showing up on my Database.

Thanks in advance,

Error can be caused by server side configuration

a) some error may occur during update operation in DB
b) you are using complex render_sql , which can be automatically used for updates
c) some other server side error

To get exact reason - enable server side log

$grid = new GridConnector($res);
$grid->enable_log(“error.log”,true);
$grid->render_table(“grid50”,“item_id”,“item_nm,item_cd”);

Do I have to set something up on my Database for it to work? Like Tables etc. ? I havent set anything up on my Database at the moment

You need to configure DB connection in connector or config.php file.
There is no need to configure anything special in DB

Hi again,

now its telling me that the table doesnt exist :S Why is that?

[code]

====================================
Log started, 26/04/2010 05:04:58

Ready for SQL generation
field =>
0 =>
0 => item_nm
1 => item_nm
1 =>
0 => item_cd
1 => item_cd
id =>
0 => item_id
1 => item_id
table =>
0 => grid50
1 => grid50

Exec SQL: SELECT item_id , item_nm , item_cd FROM grid50

MySQL error: Table ‘memomed.grid50’ doesn’t exist

Critical error in Connector, processing stoped.

[/code]

Please help :frowning:

If by some chance, related sample is missed in DB, you can import it from the attached dump
grid50.sql.zip (1.39 KB)