This topic is locked
[SOLVED]

 Query to XML output file

10/4/2013 10:37:14 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Hi All,
There is no output, does somebody see something wrong because i cannot see it.

I think it should have to work, Many thanks



//********** Check if specific record exists ************

global $conn;

$strSQLExists = "SELECT * FROM orderunits where OrderID='5'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

header("Content-Type: text/xml");
$xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>';

$xmlBody .= "<XML>";
$dynamicList = "";
while($row = db_fetch_array($data)){

$LineID = $row["id"];

$ProductID = $row["SKU"];

$Quantity = $row["Quantity"];

$CustomerOrderNr = $row["OrderID"];

$SalesPrice = $row["prize"];

$xmlBody .= '

<Detail>

<LineID>' . $LineID . '</LineID>

<ProductID>' . $ProductID . '</ProductID>

<Quantity>' . $Quantity . '</Quantity>

<CustomerOrderNr>' . $CustomerOrderNr . '</CustomerOrderNr>

<SalesPrice>' . $SalesPrice . '</SalesPrice>

</Detail>';

}
$xmlBody .= "</XML>";

echo $xmlBody;

$xmlBody->save("files/FWMS".$values["id"].".xml");

} else {

echo "Nothing!";

}
Sergey Kornilov admin 10/4/2013

Check for obvious mistakes first i.e. make sure your query returns data.
Also the following doesn't look right:

$xmlBody->save("files/FWMS".$values["id"].".xml");


According to what I see $xmlBody is a simply text variable and not an object.