re: PHP and SQL: Connect to Database VIEW POST


Do not forget that SQL is more than just the DML (Data Manipulation Language) but has DDL, DCL, and TCL, plus the possibility to create procedures and functions. In that regard, creating a user through the DML is very discourage and should use CREATE USER and GRANT command instead.

Also, in PHP, I would highly recommend using the PDO package. It helps to escape and protect for SQL Injections attack.

At last, MySQL/MariaDB offers PASSWORD() function to hash your password. So instead of comparing the plain-text password, you hash the password and compare the hashes.


Exactly your right, but i want you look at the context here.

Its a NOOB guide.

I just think, this way it easier making concepts from down to up so its possible for everyone.

What do you think?


IMHO, I would not introduce mysqli_* function to noobs since they might consider it safe. Furthermore, the PDO package is not that much complicated. The main difference is that you need to wrap it around try...catch.

For a NOOB perspective, this is perfect, but even for a noob I would use PDO and CREATE USER / GRANT command instead. But it is just my 2 cents.

Oh, and after reading back, I realized the user you were creating was in fact in your database and not the mysql inner database. My bad. Maybe just add a script to create your database with your tutorial ;)

Wow!.. Now thats why I am talking. Your literally indicating Constructive feedback and that is what I think will make this series better and more vibrant in many ways. I have taken screenshot of your comment, so i can keep it in my notes because believe me or not, i am going to use your feedback as a basis to better this.

I did mention on creating a database in the Understanding Databases tutorial. Do have a look at that and would be anxious for your feedback, maybe thats why i felt, it didnt needed to be mentioned over here.

The fact is, when creating tutorials, i have realized that I as a creator of the tutorial really much accept the fact, that people who are viewing are actually going from the start till where i am now or they have done that which i have written and coming to this. For now, i dont have a solution for this, but I think with people like you involved in the whole scenario this can be solved in one way or the other because in the end a good series is that which enables a person with no background to actually create a basis for which his background is made.

Cheer Man. Thanks for your feedback and Waiting for more.

Maybe, we can both come up with a tutorial series togethar, that would be really interesting... I guess

Code of Conduct Report abuse