Ampersand problem?


I am populating a Dhtmlx form selection object from a SQL Server database using this PHP code:

$options = new SelectOptionsConnector($res,"SQLSrv"); $options->render_sql("SELECT code, title FROM proj_title","","code,title");

The result is a display, through the dhtmlxError.catchError function, of what appears to be poorly-formed XML.

Investigating further, I discovered that I could populate the selection object if I loaded no more than the first 33 rows in the database table:

$options->render_sql("SELECT TOP 33 code, title FROM proj_title","","code,title");

Viewing row 34 in the table, I discovered the value of the ‘title’ column is:


I am fairly certain the ampersand ‘&’ is causing the emitted XML to ‘break’ and become invalid.

Two questions for you, please:

  1. Is the ampersand indeed causing the XML to become invalid?

  2. If so, how does one get around this problem?

Thank you very much for your help.

Problem confirmed and fixed.
Try to update existing php files with the attached ones (51 KB)

Hello, Stanislav,

I appreciate the codebase zip file, but there seems to be a problem with it - it seems to be either empty (no files in it) or corrupted.

Would you please provide a new codebase zip file? Thanks very much.


Please ignore my request for a new codebase zip file. I think MS file explorer was having a problem, which a reboot fixed. Thank you once again.

Greetings again, Stanislav,

The patch worked splendidly! Many thanks to you and the Dhtmlx team.