SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: XML and PHP

  1. #1
    SitePoint Addict Limes102's Avatar
    Join Date
    Sep 2006
    Location
    North Wales
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML and PHP

    Hi'a... I was wondering if it was possible to read and wirght data to and from a XML file, or would it be easier to set up a MySQL? I would like to use this method to store user information, this is the sort of information I want to store

    User names
    Password
    User email address
    Number of messages
    Actual messages

    I think this might be a bit too much. So if any one can advise me it would be much appreciated.

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    MySQL would be your best bet for this. XML is better suited for transferring data between two sources.

  3. #3
    SitePoint Addict Limes102's Avatar
    Join Date
    Sep 2006
    Location
    North Wales
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I installed MySQL and the phpMyAdmin a few months ago. I will try and get it working some how. Thanks for the advice.
    Aaron

  4. #4
    SitePoint Member Enknot's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, New York
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have the newest PHP (v. 5.1.6) there's a lot of really great XML support. Look up simple XML on the php web site, there's tons of great examples of how to use it.

    However, if you're doing something like storing user data I don't suggest using XML. XML is primarly for opening complex communication between systems and languages that don't have any other way to communicate with each other. Think Web Services and AJAX stuff (though I prefer JSON for the later). Besides if you use an XML file data access permissions on the file itself can become a huge hassle. Not to mention all some wiley son of a gus has to do to compromise your app is to download the file (I guess you could keep it a secret and make sure it's not in the web directory, but it's all more trouble than it's worth).

    You should probably use MySQL or SQLite for storing user access data. SQLite's built in and you don't need special server permissions to use it since it creates a databse file from your script. Still, it's kinda poorly documented and sometimes hard to use for lack of being able to develop, unless you use SQLite Expert, it's an application that lets you administer your SQLite Databases like an access database --google it, it'll come up fast.

    As you might have guessed using SQLite allows your whole DB to be downloaded as easily as an XML file, but there may be some ways to secure the DB I haven't really looked into it since I develop behind a ten net in a secure environment, so be careful with that too.

    I figure that there are some other pros and cons I haven't gotten into or know about, but thank good this is a forum.

    happy programming

    --enknot muja

  5. #5
    SitePoint Addict Limes102's Avatar
    Join Date
    Sep 2006
    Location
    North Wales
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks.. I'm going to choose MySQL, thanks for the advice


Bookmarks

Posting Permissions

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