I was just wondering how an SQL database provides advantages over a text file when being handled by PHP, when the text file is laid out similar to a CSV. For example, I could have a table like the following:
Code:
Name | Email
Joe | [email protected]
Ben | [email protected]
Kim | [email protected]
This would be fine as a table in a database, but couldn't this just be in a text file using the | as separators? This wouldn't automatically rule out security issues like SQL injection and the like, while still providing a medium from which data can be read (and fairly easily).

Admittedly, looking through a text file with data like the stuff above would be hell, whereas a database would be much more pleasant and easy to read - but, there is one method of attack less to try to defend.

PHP can write to databases, but writing to a text file on certain lines and cells would be impossible, so in a writing case SQL takes first place. But if it's only reading data to sort into a nice viewable format, surely a plain text file with a set separator would do nicely?

Just wanted to hear your opinions on this.

Cheers,

-jk