Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question xml and php - help

    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!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •