Create .xml file in php
I want to save this xml data in a separate .xml file in cakePHP but its not working. I used following code:
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xml.= " <registration>";
$xml.= " <id>".$a."</id>";
$xml.= " <name>".$b."</name>";
$xml.= " </registration>";
$fh = fopen('my_xmls.xml', 'w+');
what is the problem in this code or please give me a new code.
That looks fine, what's "not working" about it?
Does the actual code include the opening <?php tag?
You may want to ensure all error reporting is on, or check the PHP error log to see if there are file write permission errors or such.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
I applaud you. Cheers to CakePHP!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)