|
In case you were wondering ...
... why we used a database for such an apparently simple thing, when we could have used a text file just as easily for keeping track of a few numbers - there are two answers to that:
- A database is much easier to handle than a text file (as a database) when there are a large number of entries in the database. And the system we've described will work as well with 3 or 4 articles or 300 or 400 articles on your site. And as the number of articles increases, a true database (where you can read a single record wherever it is) will respond faster than a sequential text file (where you need to read it all to retrieve any values).
- Editing a 'real' database is a zillion times easier than editing a text-file database, especially when the database contains more information (like the article name and author name).
The third answer (if you needed one) is that the author of this article finds it much easier to work with MySQL databases than with text files. And the ulterior motive was that one day, there will be a listing of articles sorted by 'score' or sorted by the number of people who voted - and I have no idea how to even begin coding that with a text file (but I certainly can do it with a database!)
For better or worse, there it is - Rate This!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/halfadot/public_html/php_noob/rate-this.inc.php on line 59
Be the first to rate this article.
« previous
|