How can I get a value from a table into an XML without bringing in the column title?



I'm using the following function to bring a PaymentAmount from my database into an XML.



function GetPaymentTotal($orderID) {

Global $cnx;
$ptotal = null;

$sql = "SELECT value FROM orders_total WHERE class='ot_total' AND orders_id = '" . $orderID . "'";
$result = mysql_query($sql, $cnx) or die('Couldn\'t get order ot_shipping class from ' . SHOPPING_CART . ' orders_total table: ' . mysql_error());
if (mysql_num_rows($result) > 0)
{
$ptotal = mysql_fetch_assoc($result);
}

return $ptotal;

}


Using this to output:



$a_order['PaymentAmount'] = GetPaymentTotal($order->OrderNumber);


It's working, but for some reason it's bringing in the 'value' tags either side of my value... which I don't want. Here's how it looks at the minute:



<PaymentAmount>
<value>74.8501</value>
</PaymentAmount>


Here's how I want it to look.



<PaymentAmount>74.8501</PaymentAmount>


Any help would be greatly appreciated.


No comments:

Post a Comment