Hi,
I need to include user data from database fields in the Xml tree generated but I always log an “undefined index” error in the PHP error log file. The user data is included in the xml generated but the error is always in the error log … what is the problem ?
Best regards, Frédéric.
$tree = new TreeGroupConnector($link);
...
function setUserData($item) {
$item->set_userdata("etatTerrain", $item->get_value("etatTerrain"));
}
$tree->event->attach("beforeRender","setUserData");
$tree->render_table($idTable, "idx", $champTable, "", $groupeTable);
Yes, etatTerrain is an existing database field and it is include in the variable $champsTable (“etatBorne,etatTerrain”) … I have the same problem with other database tables. The user data is always right but I have a PHP notice as of it :
[09-Feb-2012 14:01:52] PHP Notice: Undefined index: etatTerrain in D:\wamp\www\knm.new\php\dhtmlx\base_connector.php on line 176
====================================
Log started, 14/02/2012 07:02:56
====================================
idTable : tree_bornes_Parc_Etat
groupeTable : etatTerrain
champTable : etatBorne,etatTerrain
SELECT DISTINCT `etatTerrain` as value FROM tree_bornes_Parc_Etat
Undefined index: etatTerrain at D:\wamp\www\knm.new\php\dhtmlx\base_connector.php line 176
SELECT `idx`,`etatTerrain`,`etatBorne`,`etatTerrain` FROM tree_bornes_Parc_Etat WHERE `etatTerrain` = 'ES'
Done in 0.046041011810303s
Thanks for provided info, it is clear why error occurs, but nor clear hot to prevent it
You are using tree-group connector, so to get items on first level separate sql query executed, which has not etatTerrain as named field ( first sql query in log ), and while executing your command it fails to get_value.
We will try to update connectors, so they will provide valid names instead of value alias for top level request. Meanwhile you can just ignore message, as it is not related to any serious issues in code.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan