...

View Full Version : best option for me: fwrite to .txt or use MySQL ?



aprestong
05-08-2008, 05:36 PM
Greetings all -

I have a quick question - hope to get some feedback.

I'm in the process of putting together a system where one person (and only one) will use a web form to submit a number. Then, a webpage will display that number.
(essentially, we want someone to update the number of available seats in a room through a form and have others view that number on a website).

This system will be used every day indefinitely.

It seems this may be so small that it doesn't require a a MySQL database. Also, I understand SQLite may be a better option, but I've never used it and may not want to bother compiling it on my dreamhost account.

I know I could use fopen() and fwrite() to keep this number in a simple .txt file, but I'm not sure if that is as reliable as a database.

I'd really like a fast and reliable way for this to be managed... I'm looking for the best method.

Any suggestions?

rafiki
05-08-2008, 05:38 PM
MySQL.

hammer65
05-08-2008, 06:40 PM
Greetings all -

I have a quick question - hope to get some feedback.

I'm in the process of putting together a system where one person (and only one) will use a web form to submit a number. Then, a webpage will display that number.
(essentially, we want someone to update the number of available seats in a room through a form and have others view that number on a website).

This system will be used every day indefinitely.

It seems this may be so small that it doesn't require a a MySQL database. Also, I understand SQLite may be a better option, but I've never used it and may not want to bother compiling it on my dreamhost account.

I know I could use fopen() and fwrite() to keep this number in a simple .txt file, but I'm not sure if that is as reliable as a database.

I'd really like a fast and reliable way for this to be managed... I'm looking for the best method.

Any suggestions?

If you are already using a database for other things, you might as well use it for this. As minimal as this is however, a text file would be fine. there don't appear to be any security concerns with what you want to do, and there wouldn't be any locking/concurrency problems. I would confirm that the value is an integer before posting it, to avoid XSS.

aprestong
05-08-2008, 06:46 PM
If you are already using a database for other things, you might as well use it for this. As minimal as this is however, a text file would be fine. there don't appear to be any security concerns with what you want to do, and there wouldn't be any locking/concurrency problems. I would confirm that the value is an integer before posting it, to avoid XSS.

This is a brand new site - so I have no existing database.
locking/concurrency problems could happen if more than one person is trying to update that .txt at the exact same time, right?
As far as I know, there will only be one person updating the status... but, that could possibly change... not sure.

Are there any other advantages to using a database? or disadvantages? I expect updates to be made rather frequently (every 5 or 10 minutes or so).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum