As Ray has also mentioned sprintf() is the best approach. I would also like to point out that you would be doing three iteration over your data so please make sure that your queries are not just 'select * from customers' but 'select * from customers where something=something'
all the best
Ian Williams wrote:
Apologies to anyone also subscribed to php.xml.dev, who will have read this earlier, but it doesn't seem as frequently read as this news group... so I am reposting...
Hi I want to write a function that will take any SQL query as a parameter, and generate XML that represents the recordset.
e.g. "SELECT * FROM Customers"
returns:
<recordset> <record id="1" name="Mr Smith" purchases="2"/> <record id="2" name="Mr Jones" purchases="25"/> <record id="3" name="Mr Davis" purchases="7"/> </recordset>
There are two approaches I think. One is to use the XML DOM, the other is simply to join lots of strings together. What is the best approach?
Thanks (and this is my first post to a newsgroup, and my first post to this one, so excuse me if I've missed something vital!)
cheers ian ;-)
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php