views:

59

answers:

5

I have a website that currently collects information when a comment is left (Name, number etc...) but right now I just have a PHP script that sends an email to me with that info using the mail() function. I don't know if MySQL might be extreme, but Id like a way to put their info into some kind of database. Thanks!

A: 

Using a Database engine would be a great Help. I can just say save everything to it. You save Time, save Money and save a lot Headaches.

streetparade
+2  A: 

If all you are going to need is to keep track of comments you could opt for a more lightweight database such as SQLite

Not that SQLite is not suited for more heavy lifting.

Jan Hančič
+4  A: 

If you do use a database be very wary of PHP tutorials on the internet. Most of them have terrible example code that should never be used (The majority view sql injections as a problem that happens to someone else).

If you do chose MySql, I would recommend you do not use the php mysql extension (i.e. Don't use functions that start mysql_). Use the mysqli or pdo extensions. These make the code more foolproof and if used correctly should automatically strip input that could cause a sql injection.

In my opinion you MUST understand is sql injections if you ever do anything with databases, regardless of what database you end up using. Using the php extensions I recommended should help prevent them but it is no substitute for understanding why you shouldn't combine user controlled values directly into a sql query.

Yacoby
A: 

MySQL ia a very easy to learn DB, and probably the best solution for you, because your host company have MySQL on their servers, which means it's applicable to your site. Check this out here and here and if you like pdf here.

vaske
A: 

If your server already had a MySQL (or any other RDBMS) installed you just need to learn basic of SQL language and PHP API to execute those queries.

PHP uses few extensions to communicate with MySQL. You can use mysql, mysqli or PDO. And the last one is the best choice (but you have to know basics of object oriented programming). SQL syntax is really easy for a simple CURD (Create, Update, Retrieve, Delete) operations. I know that beginners doesn't like official documentations so I suggest to learn from some tutorial - you should find a lot on Google - check this out

Crozin