Database or Text file?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mettlehead
Forum Newbie
Posts: 15
Joined: Fri Oct 11, 2002 11:03 am
Location: Canada

Database or Text file?

Post by mettlehead »

Hi,

I need to create a simple user register sample for a client. I am not to familiar with a database with php. Should I just create a text file to hold the users for now? Is it much faster and easier? Or is it not very safe to do that?

Thanks
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

text files are:

slower (but not that much)
harder to handle
less flexible
risky when it comes to security

if you have the option of using a db, learn how to use it. otherwise, stick with textfiles.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

aye, text files are the devil when it comes to holding very sensative materials such as username/passwords...

it's REALLY not that hard at ALL using mysql. I posted a really easy way to authenticate a user using mysql, including the steps to create the database, table, and call the values.

truthfully, if you only learn to use text files, you are seriously going to hurt yourself in the long run when you need to make php scripts that hold customer information, authentication, reports, etc...
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

i concure, use a database whenever and wherever possible.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Database are designed for these jobs whereas file system isn't. Also .txt you can view the content much more easily than database. Even if you encrypt the password it's still dangerous since you can brute force attack the string. Just learn to use MySQL or PostgreSQL and you can implement it on any other project!
Post Reply