My first post on this forum.
Im new to the world of Php and am learning very fast and enjoying the pleasures gained from bringing things to life:) I am currently a good chunk of my way through developement of a new site and I have one question that I already have a few answers for.
Basically for say a blog system, communicating the contents of a folder and captions (for dynamic picture gallery), internal email system and off the top of my head say a news system am I better off using xml or mysql?
For instance - the dynamic picture gallery automatically uploads images, creates thumbnails into specific user folders - then I will either read the src of the images and captions from the table in the database or from an xml file where they are stored. Pretty much the same theory for the rest. Also the usual delete and add theory for xml and database (as in the storage method is not going to get clogged up with redundant information)
I have read that xml is good for portability between programs as such and also that mysql is very fast - but I am still a little confused as to the best way to turn for the storage of this data. Considering php will be the face of submitting and retriving both forms of data and the processes used will be reflected across different user profiles. I obviously want the site I am creating to be as fast as possible and to be as scaleable as possible and basically wish to design and create it by using best practices.
So what do you say? Xml or Mysql
Anyway your thoughts would be appreciated on this.
Xml or Mysql?
Moderator: General Moderators
Re: Xml or Mysql?
If you want it to be fast and scalable that MySQL is the only choice. Using XML wouldn't be scalable, and probably wouldn't be very fast unless you created some elaborate caching system.
Of course, ideally you should use an abstraction layer between your code and the data. Not sure that would be something I'd recommend if you're completely new to it all though. It's quite complicated.
Of course, ideally you should use an abstraction layer between your code and the data. Not sure that would be something I'd recommend if you're completely new to it all though. It's quite complicated.
Re: Xml or Mysql?
Thanks, so apart from portability why is xml apparently so good with php5? (even your tag makes it sound as good as ultra violence!)
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Xml or Mysql?
parsing XML is easier with PHP5 than it was in previous versions, but that doesn't mean XML is well suited to your task.
MySQL FTW!
MySQL FTW!
Re: Xml or Mysql?
The main thing is, MySQL is a database engine and XML isn't. XML is a markup language. A flat file containing XML is just a flat file; in and of itself, it has no search capabilities, no nothing. XML itself isn't a medium of storage at all, it's a format.
Asking whether you should store your data in MySQL or XML is something like asking whether you should cut your hair with scissors or enthusiasm.
Asking whether you should store your data in MySQL or XML is something like asking whether you should cut your hair with scissors or enthusiasm.
Re: Xml or Mysql?
Bwa ha ha ha. That's awesome.chaos wrote:...like asking whether you should cut your hair with scissors or enthusiasm.
But I digress...
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Xml or Mysql?
But in the case of say an internal email system, a message sent from say "admin" that will be sent to every site users inbox - for that to be stored in an xml file and for ever users inbox to read that xml file rather than communicating with the database would surely be better? Or am I underestimating the speed of mysql?
Re: Xml or Mysql?
You are underestimating the speed of MySQL, or any database engine. That sort of thing is what they're for.
Re: Xml or Mysql?
excellent news - thanks for all the replys