0

I have a simple php script that pulls data from MySql and builds a feed, in this case for Amazon.

It generates the data correctly, but every 300-400 lines or so, it generates an isolated XML error where the closing "<" is missing. For example, here is a piece of my output that is not outputting the "<" on the closing tag for Fulfillment Latency. Sometimes it will occur under sku, quantity or update. It will always be the "<" on the closing tag.

<Message>
<MessageID>36</MessageID>
<OperationType>Update</OperationType>
<Inventory>
<SKU>NRS10111</SKU>
<Quantity>2</Quantity>
<FulfillmentLatency>1/FulfillmentLatency>
</Inventory>
</Message>

Here is part of the code (within a mysql_fetch_array loop) used to generate the XML, :

$myXML.=
'<Message>
<MessageID>'.$counter.'</MessageID>
<OperationType>Update</OperationType>
<Inventory>
<SKU>'.$sku.'</SKU>
<Quantity>'.$quantity.'</Quantity>
<FulfillmentLatency>1</FulfillmentLatency>
</Inventory>
</Message>';

$counter++
Kevin
  • 349
  • 1
  • 2
  • 10
  • What you describe seems impossible with the code you show. Are you 100% sure you're not fiddling with the result later (say doing some str_replaces) or have an alternative `$myXML.=` block somewhere? – Pekka Nov 06 '12 at 06:59
  • $myXML was wrapped in another string to complete the XML. This other string used << – Kevin Nov 06 '12 at 07:27
  • Off topic, but since you mentioned `mysql_fetch_array()`, I should point out that the `mysql_xxx()` functions are considered obsolete and are in the process of being deprecated. You might want to see this question: http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-function-in-php for more info. – Spudley Nov 06 '12 at 07:41

0 Answers0