Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate XML from PHP via SQL
    primarykey
    data
    text
    <p>i have a error when running this code .. i run fine when there is no special characteres in database. if its has special characters then i got the error please solve me i am very thankful.</p> <p>Following Error are occured when any special charachers in database like " ' &amp; ? " i don't why those error come .. and i am not using DOM or XMLWrite just simple create the xml via file, and clerify 1 thing that CDDATA also not working for my code i check it. Please tell me some thing how could i make the xml with error less..</p> <p>following are the code:</p> <pre><code> $file= fopen("../xml/{$productID}.xml" , "w"); $_xml ="&lt;?xml version=\"1.0\" encoding=\"UTF-8\" ?&gt;"; $_XML = "&lt;!DOCTYPE Server SYSTEM \"opt/pdos/etc/pdoslrd.dtd\"&gt;"; $_xml .="&lt;productsnode&gt;"; while ($row = mysql_fetch_array($productQuery, MYSQL_ASSOC)) { $_xml .=" &lt;product&gt;"; $_xml .=" &lt;productID&gt;" . $row['productID'] . "&lt;/productID&gt;"; $_xml .=" &lt;productName&gt;" . htmlspecialchars($row['productName']) . "&lt;/productName&gt;"; $_xml .=" &lt;productDescription&gt;" . htmlspecialchars($row['productDescription']) . "&lt;/productDescription&gt;"; $_xml .=" &lt;productPicture&gt;" . htmlspecialchars($row['productPic']) . "&lt;/productPicture&gt;"; $_xml .=" &lt;category&gt;"; $_xml .=" &lt;categoryID&gt;" . $row['categoryID'] . "&lt;/categoryID&gt;"; $_xml .=" &lt;categoryName&gt;" . htmlspecialchars($row['categoryName']) . "&lt;/categoryName&gt;"; $_xml .=" &lt;categoryDescription&gt;" . htmlspecialchars($row['categoryDiscription']) . "&lt;/categoryDescription&gt;"; $_xml .=" &lt;categoryPicture&gt;" . htmlspecialchars($row['categoryPic']) . "&lt;/categoryPicture&gt;"; $_xml .=" &lt;subCategory&gt;"; $_xml .=" &lt;subCategoryID&gt;" . $row['subCategoryID'] . "&lt;/subCategoryID&gt;"; $_xml .=" &lt;subCategoryName&gt;" . htmlspecialchars($row['subCategoryName']) . "&lt;/subCategoryName&gt;"; $_xml .=" &lt;subCategoryDetail&gt;" . htmlspecialchars($row['subCategoryDescription']) . "&lt;/subCategoryDetail&gt;"; $_xml .=" &lt;/subCategory&gt;"; $_xml .=" &lt;/category&gt;"; $_xml .=" &lt;/product&gt;"; } $_xml .="&lt;/productsnode&gt;"; fwrite($file, $_xml); fclose($file); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload