Hi,
I am starting to use dhmltxTree to load tree data from mysql database. But it shows a Message pop up window said
" Error type:DataStructure
Description: XML refers to not existing parent"
In my server side php code, I wrote:
“$res = mysql_connect(“localhost”,“root”,”“);
mysql_select_db(“test”);
require(”…/codebase/tree_connector.php");
$tree = new TreeConnector($res,“MySQL”);
$tree->render_table(“product”,“product_id”,“Product_Name,Product_Version”,“”,“”);"
May i ask what is the last parameter meaning in "$tree->render_table "? Is anything wrong with code. I think it probably is the problem of the last line of the code, but i could not figure out why. Could you please help me with that? Thank you very much…
May i ask what is the last parameter meaning in "$tree->render_table "?
Last field - name of key, which is used to store parent ID ( normally you have in table id and parentId fields - to organize tree like hierarchy )
Without last parameter info about parent id is missed from xml and as result tree can’t be loaded correctly.
Hi Stanislav,
Thank you for your response. But what if this is the top level in the tree, which parentid i should put. e.g. i create a table:
" Create table developer( dev_id int(11) not null auto_increment, del_name varchar(255) not null, primary key(dev_id));"
If i want to show a one level tree, can i write:
$tree->render_table(“developer”,“del_id”,“del_Name”,"","")?
But when i run the php file, it outputs :
"SELECT FFMID
,FFMName
FROM formfactormsa WHERE `` = ‘0’
!!!Uncaught Exception
Code: 0
Message: MySQL operation failed
Unknown column ‘’ in ‘where clause’
"
Could you tell me why? Thank you very much…
Hi,
Just a mistake, in the php error output it should be:
"SELECT del_id
,del_name
FROM developer WHERE `` = ‘0’
!!!Uncaught Exception
Code: 0
Message: MySQL operation failed
Unknown column ‘’ in ‘where clause’
"
instead of
"SELECT FFMID
,FFMName
FROM formfactormsa WHERE `` = ‘0’
!!!Uncaught Exception
Code: 0
Message: MySQL operation failed
Unknown column ‘’ in ‘where clause’
"
Thanks…
Code expects that you have
Create table developer(
dev_id int(11) not null auto_increment,
parent_id int(11),
del_name varchar(255) not null, primary key(dev_id));
and later
$tree->render_table("developer","del_id","del_Name","","parent_id")
for top level records parent_id must be a 0
If you need to output the tree structure from table with different structure you can form xml text manually, it has a pretty simple format.
I have done exactly as you’ve stated, but still I get the same error. Please see my code below and advise.
My HTML Page from which I call a PHP page for loading XML:
##########################################################
[i]
[/i]
##########################################################
This is the PHP file New1.php that’s supposed to generate XML
##########################################################
<?php
require("./php/codebase/db_postgre.php");
require("./php/codebase/tree_connector.php");
$dbconn =pg_pconnect(“host=localhost port=5432 dbname=abcd user=postgres password=mk”);
$tree = new TreeConnector($dbconn);
$tree->render_table(“developer”,“del_id”,“del_Name”,"",“parent_id”);
?>
##########################################################
I think there is a serious bug in DHTMLX. Kindly advice on the remedy.
Regards
MK.
Try to open New1.php directly in browser.
Do it generates a valid XML ? If it doesn’t them try to enable logging for the connector and check the content of log.
docs.dhtmlx.com/doku.php?id=dhtm … tor:errors
Hi,
I have taken your advise and executed the PHP file. The result is as displayed in the attached file.
The PHP terminates with 500 Error. When I switch on the Developer Tools in Chrome, I get the following header information.
Request URL:http://localhost/sinew/sinew/New1.php
Request Method:GET
Status Code:500 Internal Server Error
Request Headersview parsed
GET /sinew/sinew/New1.php HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
DNT: 1
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,hi;q=0.6
Response Headersview parsed
HTTP/1.0 500 Internal Server Error
Date: Thu, 13 Mar 2014 10:40:35 GMT
Server: Apache/2.4.7 (Win32) PHP/5.4.23
X-Powered-By: PHP/5.4.23
Content-Length: 0
Connection: close
Content-Type: text/xml
What is surprising is that I also get a blank XML without tags despite this error. Kindly help out.
Regards
Manish.
Well, got to the root of the problem and found out that this was a bug in the file db_common.php. I’m using Postgresql as my database, but this is not handled in the db_common.php file. I kindly request the DHTMLX team to look into this. We are very seriously evaluating UI Toolkits and Frameworks for building our Enterprise Applications for Very Large Enterprises. I have recommended DHTMLX very strongly in the organization and am responsible for creating a sales-pitch for DHTMLX against JQuery Easy UI and Ext JS. Kindly help out on a priority basis please.
A major query is: Is DHTMLX team supporting Postgresql database? If not we’ll have to look at some other tools/frameworks.
The Error is identified clearly in the debugger images below. This is a set of 2 images, so you’ll have to scroll down and across to get the full picture.
Thanking you
Regards
Manish Kumar.
You can use connectors with postgresql
To do so you need to include connector/db_postgre.php and use code like next
<?php
require("./php/codebase/db_postgre.php");
require("./php/codebase/tree_connector.php");
$dbconn =pg_pconnect("host=localhost port=5432 dbname=abcd user=postgres password=mk");
$tree = new TreeConnector($dbconn, "Postgre");
$tree->render_table("developer","del_id","del_Name","","parent_id");
?>
I have executed the your proposed code, and I get the following errors in my browser, as I have set ini_set(‘display_errors’, 1) in my PHP file. This is not a coding issue but a bug. Can you please suggest the URL for older and more stabler versions so that I can download the one with Postgresql compatibility. Or at least provide me the required debugged file: db_postgre.php and other dependent files for me to take off.
[b]Warning: pg_query(): Query failed: ERROR: column “del_id” does not exist LINE 1: SELECT del_id,parent_id,del_Name FROM developer WHERE parent… ^ in E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\db_postgre.php on line 13
Fatal error: Uncaught exception ‘Exception’ with message ‘Postgre - sql execution failed ERROR: column “del_id” does not exist LINE 1: SELECT del_id,parent_id,del_Name FROM developer WHERE parent… ^’ in E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\db_postgre.php:14 Stack trace: #0 E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\db_common.php(668): PostgreDBDataWrapper->query(‘SELECT del_id,p…’) #1 E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\base_connector.php(531): DBDataWrapper->select(Object(DataRequestConfig)) #2 E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\base_connector.php(512): Connector->get_resource() #3 E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\base_connector.php(409): Connector->render() #4 E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\w in E:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\sinew\sinew\php\codebase\db_postgre.php on line 14[/b]
Please ignore or delete my last reply to this post. Problem solved. Actually there was corruption in the file system. I acknowledge the same in this post. Thanks much friend, you were a great help.