0 Replies Latest reply on Aug 16, 2009 3:07 PM by Marlene

    ampersand problem with xml coming from mysql via php

    Marlene Level 1

      I am querying a mysql database and using a php script to output xml using an HTTPS Service call. I have everything working except that one of the mysql fields is a text field containing the names of some stores that incude ampersands in their name. I know I could change them by going in and changing them to & but I know there is a way to do this in the php script. I have found a number of solutions but I can't seem to work them into my existing code which I have included the snippet where it needs to go.

       

      while ($row = mysql_fetch_array($result)) {

         

       

      $merchantname = $row['merchantName'];

      ]

          

      $MERCHANTPROFILE = $xml->createElement('MERCHANTPROFILE');

            $MERCHANTPROFILE = $root->appendChild($MERCHANTPROFILE);

           

      $merchantNameElement = $xml->createElement('merchantName', $merchantname);

            $merchantNameElement = $MERCHANTPROFILE->appendChild($merchantNameElement);

       

       

       

      $merchantStoreCategoryElement = $xml->createElement('merchantStoreCategory', $merchantstorecategory);

            $merchantStoreCategoryElement = $MERCHANTPROFILE->appendChild($merchantStoreCategoryElement);

       

          }

        }

      }

      echo $xml->saveXML();

      ?>