etrader Posted May 17, 2011 Share Posted May 17, 2011 I want to store a series of data which are called in a main php file. Do you suggest to store them in xml as file1.xml: <title>TITLE</title> <content>CONTENT</content> or file1.php: $title="TITLE"; $content="CONTENT"; AND is it better to create separate file for each article or storing all data in one single file? Quote Link to comment https://forums.phpfreaks.com/topic/236621-storing-data-in-php-or-xml-files/ Share on other sites More sharing options...
spiderwell Posted May 17, 2011 Share Posted May 17, 2011 if you store it all in a database, you can parse it as xml if required or push it to php variables, getting the best of both. as for storing in seperate files, I wouldn't do that personally, but I don't think theres a huge amount of difference other than creating a method for file naming so you can keep track of all the files. with a database you can have better control of your data also, such as filtering and ordering, which is all built into databases. file systems do have functionalitys like that but it refers to the date a file was changed, not say when the article was written. Quote Link to comment https://forums.phpfreaks.com/topic/236621-storing-data-in-php-or-xml-files/#findComment-1216440 Share on other sites More sharing options...
etrader Posted May 17, 2011 Author Share Posted May 17, 2011 Thanks spiderwell, I hope to avoid mysql database, as the system is simple and I prefer not to get involved with slow queries. Regarding one single file, I was thinking of problem associated with large file; as in the case of separate file, only a small file is read for each query. Quote Link to comment https://forums.phpfreaks.com/topic/236621-storing-data-in-php-or-xml-files/#findComment-1216463 Share on other sites More sharing options...
micmania1 Posted May 17, 2011 Share Posted May 17, 2011 Have you looked into the possibility of JSON? json_encode() json_decode() Quote Link to comment https://forums.phpfreaks.com/topic/236621-storing-data-in-php-or-xml-files/#findComment-1216467 Share on other sites More sharing options...
spiderwell Posted May 17, 2011 Share Posted May 17, 2011 Thanks spiderwell, I hope to avoid mysql database, as the system is simple and I prefer not to get involved with slow queries. Regarding one single file, I was thinking of problem associated with large file; as in the case of separate file, only a small file is read for each query. if the system is simple, how are the queries slow? in regards to files i guess its down to personal preference, but I think unless the site is going to have a LOT of traffic, like 1000's per hour, do you need to worry about performance that much? just how big or busy is the site going to be? do you really need to worry about saving micro times (for want of a beter word) Quote Link to comment https://forums.phpfreaks.com/topic/236621-storing-data-in-php-or-xml-files/#findComment-1216528 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.