-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Registration.php : PDO support #154
Conversation
Replace mysqli functions by PHP PDO functions in all database calls. Replace all direct calls to "new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME)" by the function "private function databaseConnection()" This function check if database connection already opened, create connection if needed and return true or false (if false, error message is added to error string of the class)
This is a good feature, thanks for that, but we already had a discussion about that several months ago here: Do the users, that use 2-advanced version, really know what PDO is and how to use it ? If they wand to build an application out of it, is it even useful to bring PDO into the game ? |
I agree with @panique. This script is meant to be accessible to everyone (i hope i'm on the right lines here), and although many people understand pdo, some do not. |
PDO is standard since PHP version 5.1 (far away) and it's a key feature for safety on SQL injection. MySQLi is the old way to do and PDO is the futur of PHP, so people have to learn... You can keep MySQLi for 1-minimal if you want but 2-advanced is already address to a public knowing PHP. Don't migrate to PDO now will be more difficult when php-login will be bigger. |
@devplanete That might be totally true, but the reality is that most people who use this script dont even know what PDO is. This leads to the question: Do we want to "teach" the users to use PDO, or simply provide a script that fits their current coding behaviour ? And do users reject scripts if it uses an "unknown" technology ? Does anybody know some statistics about this ? By the way: The 4-full-mvc-framework uses PDO. |
Personally, I think it would be stupid to reject a technology just because you think it's hard or you can't be arsed to learn it. Just saying... |
@panique Please let me know your final decision about PDO inside 2-advanced. I think that I will migrate Login.php to PDO in the coming days but if you are not interested in... I will have to maintain my own version and it will not be an easy task... |
I would like to ask into the room: What are the DISadvantages when implementing PDO into In my opinion the important points are:
Ahhh let's use PDO ;) It's not a popular choice, but it's the right choice ;)But: let's write a guideline on using PDO, as the people will definitly need this! |
@devplanete Wonderful, let's go PDO! Thanks for the commit, I'll merge it when all database requests are PDO-style (otherwise it wouldn't make sense to merge). |
ok thanks for your support, I'm convinced that it's the best choice |
I think that's the right choice, too. So it's okay to do that ;) |
@Dominic28. That' basically a polite version of what I said. Lol. |
I vote for PDO. PDO is the modern way of handling databases in PHP =) |
Update Registration.php : PDO support
Replace mysqli functions by PHP PDO functions in all database calls.
Replace all direct calls to "new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME)" by the function "private function databaseConnection()"
This function check if database connection already opened, create connection if needed and return true or false (if false, error message is added to error string of the class)