Please Help!
I get the ‘Incorrect XML’ dialog popup after updating a record. I use the same query for populating a grid as I do when populating the grid. I have no problem loading the grid data.
When populating the grid (works) - server side carriers_connector.php script: require(”./dhtmlx/dhtmlxConnector/codebase/grid_connector.php”); $res=mysql_connect(“localhost”,”root”,”mypassword”); mysql_select_db(“TM”); $grid = new GridConnector($res,”MySQL”); $grid→render_sql(“SELECT ID,NAME,CODE,URL,STATUS_FK,‘Web’ AS LINK FROM CARRIER”, “ID”,”ID,NAME,CODE,URL,STATUS_FK,LINK”,”LINK”,””);
My server side php update script (carriers_update.php) based on your examples posts the xml error:
$res=mysql_connect(“localhost”,”root”,”mypassword”); mysql_select_db(“TM”); require(‘dhtmlx/dhtmlxConnector/codebase/grid_connector.php’); $grid = new GridConnector($res,”MySQL”); $grid→enable_log(“temp.log”,true); $grid→sql→attach(“Update”,”Update CARRIER set NAME=’{NAME}’, CODE=’{CODE}’, URL=’{URL}’, STATUS_FK={STATUS_FK} WHERE ID={ID}”); $grid→render_sql(“SELECT ID,NAME,CODE,URL,STATUS_FK,‘Web’ AS LINK FROM CARRIER”, “ID”,”ID,NAME,CODE,URL,STATUS_FK,LINK”,”LINK”,””);
Quite frankly, I am a bit surprised that I need to use render_sql after a simple update procedure. Why should you need to resend updated table data to a grid that already has the data in the first place.
This is my boiled down client script (I am not showing the includes here but they are there): var grid = win.attachGrid(); grid.setImagePath(“dhtmlx/dhtmlxGrid/codebase/imgs/”); grid.setHeader(“ID,Name,Code,URL,Status,Website”); grid.setColumnIds(“ID,NAME,CODE,URL,STATUS_FK,WEBSITE”); grid.setInitWidths(“50,150,50,*,60,60”); grid.setColAlign(“right”); grid.setColTypes(“ro,ed,ed,ed,coro,button”); grid.enableEditEvents(true, true, true); grid.setColSorting(“int, str”); grid.getCombo(4).put(0, ‘disable’); grid.getCombo(4).put(1, ‘one’); grid.getCombo(4).put(2, ‘two’); grid.setSkin(“dhx_skyblue”); grid.init(); grid.load(“http://localhost/rms/carriers_connector.php”); dataProcessor = new dataProcessor(“http://localhost/rms/carriers_update.php”); dataProcessor.enableDataNames(true); dataProcessor.setDataColumns([false,true,true,true,true,false]); dataProcessor.init(grid);
When I change the update script (carriers_update.php) to something like the following it works, but only for one update per record. In other words, if I edit one cell it updates properly, but will not update the second cell of the same record.
header(‘Content-Type: text/xml’); $res=mysql_connect(“localhost”,”root”,”mypassword”); mysql_select_db(“TM”); if ($nativeeditor_status==‘updated’) {
$STATUS_FK = intval($STATUS_FK);
$ID = intval($ID);
if ($URL==’’) $URL=“NULL”;
else $URL = “’$URL’”;
$sql = “UPDATE CARRIER SET NAME=’$NAME’, CODE=’$CODE’, URL=$URL, STATUS_FK=$STATUS_FK WHERE ID=$ID;”;
$rs = mysql_query($sql,$res);
} echo ‘<?xml version=“1.0” encoding=“ISO-8859-1”?>’;
What might help quite a bit is seeing your update.php script (which works quite fine) as it is being used in: dhtmlx.com/docs/products/dht … _init.html
Thanks for your help.