I'm retrieving an XML code from the database and storing it as a variable in php. However when I try to use this variable inside an XML code, it gives me an error. Here is my code:
<?php
$conn = mysqli_connect('localhost', 'root', '', 'thisdatabase');
$result = mysqli_query($conn, 'SELECT * FROM createdproduct');
while ($row = mysqli_fetch_assoc($result))
{
//$selected = (isset($_POST['list']) && $_POST['list'] == $row['id']) ? 'selected' : '';
//echo htmlentities($row["productURL"]);
$test = htmlspecialchars($row["productURL"]);
}
//echo htmlentities($test);
?>
and this is my XML wrapped in php:
<?php
//some code
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://api.mydomain.net">
<orderItems>
'.$test.'
</orderItems>
<payment>
<type>typ</type>
</payment>
<shipping>
<shippingType id="00"/>
<address type="private">
<person> <
<salution id="1"/>
<firstName>person</firstName>
<lastName>person</lastName>
</person>
<street>street</street>
<houseNumber>00</houseNumber>
<city>city</city>
<country code="US">USA</country>
<state code="mm">California</state>
<zipCode>111</zipCode>
<email>aaa@mydomain.net</email>
<phone>+49 341 789 123</phone>
<fax>+49 341 789 123</fax>
</address>
</shipping>
</order>';
//some code
?>