combo and '&' characters


Shown below is the sample code, amended for my DB to autocomplete a combobox.

The combo box will not load the option correctly when you have an ‘&’ character in the field. It will work if there is a space.

Example :

‘A&’ - truncates to ‘A’

‘A &’ - shows proper options

I am calling the combo like this:

    var z=dhtmlXComboFromSelect(“label”);




    print("<?xml version=\"1.0\"?>");

$link = mysql_pconnect(“xx”, “xx”, “xx”);

$db = mysql_select_db (“xx”);

    if (!isset($_GET[“pos”])) $_GET[“pos”]=0;

        $sql = “Select * from tblLabel”;

         $res = mysql_query ($sql);



    function getDataFromDB($mask){

        $sql = “SELECT DISTINCT label FROM tblLabel Where label like


        $sql.= " Order By label LIMIT “. $_GET[“pos”].”,20";

        if ( $_GET[“pos”]==0)




        $res = mysql_query ($sql);



                $thisLbl = $row[‘label’];


             print “”;




            echo mysql_errno().": “.mysql_error().” at “.LINE.” line in

“.FILE.” file





try to use A& instead of A&. For example:


I used the htmlspecialchars() php function…

and that solved it!