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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    110
    Thanks
    1
    Thanked 0 Times in 0 Posts

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

    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?

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    MySQL.

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by aprestong View Post
    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.
    Deliver yesterday, code today, think tomorrow.

  • #4
    Regular Coder
    Join Date
    Jul 2006
    Posts
    110
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by hammer65 View Post
    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).


  •  

    Posting Permissions

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