View Full Version : xml and php - help

05-29-2004, 06:33 PM
Hello, I wanted to know if I have the ability in my php code to access the mySQL db and display the contents to a page. why would I wanted to put it in a XML form and parse the XML to my page.

I guess what I want to really know when is a good time to use XML and php, I understand that XML can be used with pretty much all applications.

So if I write a php page and take the data from mySQL and put it in XML format, .... then have to write another page to access the XML page to display it.

I hope someone can understand what I am trying to say. :-)

Thanks to anyone that reponds!

05-29-2004, 10:38 PM
Well I'm probably not the best person to answer this, since i share your view.

However i could see how XML would be useful for providing a form of 'public' database. XML files can be read by anyone (generally speaking) but edited only by you. Databases remain locked away - and should stay that way.

so I'm saying that XML would be useful for a news feed or similar where other sites can red your XML file to see whats happening etc.

05-30-2004, 04:31 AM
I agree in general , that there is no point in using a database +scripting language to create an XML file to then have to transform that XML file back to HTML (be the transformation client or serverside)...

however , XHTML is XML , so make your output valid XHTML and you (to a point) have the best of both worlds , in that your output can now be transformed via CSS to suit all browsers + is parsable by any XML parser (into say PDF/whatever).

XML is very useful , but personally I think its transformation is often over-used, RSS/RDF etc require specific XML to be built & thats something PHP/MySQL can do very quickly , transformation from 1 XML document to another is quite possible but resource intensive and to my view overly complex when (assuming @ DB & server-side language) a simple query + template in PHP can do the same job.