Web 7: connect php site to a mysql database for login check
Goal
Instead of using an array to hold valid users and their passwords, a mysql innodb table - called users, is queried. Its structure is:
-
username:
-
is the primary key
-
-
fullname
-
password
See the sql template file for the innodb table skeleton.
The student determines what data type the fields should be when creating the table.
Finally, the student uses sql through the pdo library to authenticate the user logging into the basic php site.
If necessary, the student and I can meet, for me to demonstrate the basics of data table design (database normalization).
Contact Mike Hurst to setup a student database account for yourself. I need to test the final result.
Tutorials
I am not sure how useful LinkedIn learning is for this.
Basic:
-
Database design:
-
read the table relationship and data normalization sections of 'Sql Visual Quickstart Guide.'
-
-
'Why you Should be using PHP’s PDO for Database Access,' https://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access—net-12059
-
'(The only proper) PDO tutorial' is a very comprehensive tutorial, https://phpdelusions.net/pdo
Intermediate:
-
'PDO vs. MySQLi: The Battle of PHP Database APIs' has some nice code examples, https://websitebeaver.com/php-pdo-vs-mysqli
General References
-
Tania Rascia has a gem of a site with easy to understand introductory to intermediate tutorials - https://www.taniarascia.com/blog/ - on css, mysql, php, and jquery
-
-
Excellent php best practices, https://phpdelusions.net/
-
-
https://php.net/ is php’s definitive reference
-
'Mozilla Developer Network,' https://developer.mozilla.org/en-US/.