According to stackoverflow.com/a/6853534
A text file doesn't support writing by multiple users (what if two people are posting to the same room at the same time?), and can easily become corrupt.
All things considered, I'd say it's better across the board to use a DB, even if it's something simple like SQLite, which has excellent PHP support. However, consider the many-users condition, MySQL is probably a much better choice.
It's still not clear for me, can saving data in SQLite simultaneously by a few users make SQLite database file corrupt?
Or maybe SQLite is not just a flat-file that is using SQL queries makes the difference?
CodePudding user response:
SQLite primarily targets single-user, single-process use cases. However, some concurrency is still supported. The level of resiliency depends on whether thread-safety features have been disabled during compilation. Another important consideration is journaling mode (for details, see discussion of the atomic commit feature and references therein), but, basically, the newer WAL mode is designed to improve concurrent access. For discussion on how SQLite database may get corrupted, see this.
CodePudding user response:
I think SQLite is for local use.
For example on a user device data is stored and when the system is idle, the data is updated in a 'main' database.