Unable to populate a combo from a mysql table

Hello,

I’m trying your samples to populate a combobox from a mysql table, just adapted to my database.
Nothing is working, what I’m doing wrong ?

Here is the code :

basic_connector.php
Dwh_Unimag : database
Structure : table

[code]

<?php $res=mysql_connect("10.xx.yy.zz","root","mypassword"); mysql_select_db("Dwh_Unimag"); require("codebase/combo_connector.php"); $combo = new ComboConnector($res); $combo->render_table("Structure","id_structure","nom"); ?>[/code]

basic.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Test Combobox</title>
	<script>
		window.dhx_globalImgPath="../dhtmlx/imgs/";
	</script>

	<script src="codebase/dhtmlx.js" type="text/javascript" charset="utf-8"></script>
	<script src="codebase/connector.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" href="codebase/dhtmlx.css" type="text/css" charset="utf-8">
</head>
<body>
	<div id="combo_zone4" style="width:200px; height:30px;"></div>
	<hr/>
	<div id="combo_zone5" style="width:200px; height:30px;"></div>
	<hr/>
	<script>
		var z=new dhtmlXCombo("combo_zone4","alfa4",200);
		z.loadXML("basic_connector.php");
	</script>
	<script>
                var z=new dhtmlXCombo("combo_zone5","alfa4",200);
		z.enableFilteringMode(true,"basic_connector.php",true);
	</script>
</body>
</html>

I need your help, I don’t understand my mistake.

Regards

Try to change the code like next

$combo = new ComboConnector($res); $combo->enable_log("log.txt"); $combo->render_table("Structure","id_structure","nom");

and check the content of log.txt file, it will contain info about request processing and possible errors.

Hi Stanislav,

I’ve added : $combo->enable_log("/var/www/blueprint/log.txt");
I’ve launch directly from browser : basic_connector.php,

Here is the results of Log.txt :

====================================
Log started, 15/06/2016 09:06:59

Source:Structure
Fieldset:
Where:
Start:
Count:

Relation:

SELECT nom,id_structure FROM Structure

Done in 0.002161979675293s

Heres is the result of $combo->render_table(“Structure”, “nom”, “id_structure”);

<?xml version="1.0" encoding="UTF-8"?>

And my combobox is still EMPTY !

Both code and XML output look fine.
If problem occurs in FF, it may be caused by some whitespace in PHP script output, before the starting <?xml tag

If it helps, I can send you the sample which uses the static XML with same content as output of XML script in your case, and it does work.

it would be of great help if you can send me your example.
Thanks for your help.

Please check the next demo

s3.amazonaws.com/uploads.hipcha … dhx-12.zip

Thanks Stanislav for your example.

I’ve replaced this :

z.loadXML("basic_connector.php");

by

z.load("basic_connector.php");

Now, it’s working.

Regards