My Sequel – MySQL

My_SequelMySQL is a relational database management system.   You can use it to store and retrieve information.  This information could be your inventory for your store, usernames/passwords for your site, or even your site itself.  Your database can have several tables and each table can have rows of data.  You need to set up the structure for your database yourself.  You will need to create a database and assign a user with privileges to access it.  phpMyAdmin is a tool that many hosts provide that can make the creation of the database structures much easier using a visual interface.   MySQL is fairly human readable and includes commands like INSERT, DELETE, and SELECT.

PHP allows you to access the MySQL database.  In the past, this was done using the mysql_connect() or mysqli_connect() commands.  One can now use the PDO or PHP data object to connect to the MySQL database.  One advantage of the PDO object is that you can prepare statements prior to executing them.  This can reduce the risk of SQL injection.  SQL queries are strings and frequently include user given data such as a username.  Instead of “Bob”, a malicious user might type “Bob and AccessLevel=100”.  Even using the PDO object and prepared statements, I would suggest verifying all data that comes in from users and sanitizing all data that is going out to the browser to avoid placing malicious code into your database or should it get in avoid distributing it.

Manipulating data quickly is what the web is all about.  The combination of PHP with MySQL can help you do it.

About Robert

Robert is a novice web site developer. A lack of professional training has not prevented him from creating some very nice websites for small businesses who would otherwise have gone without a web presence.

Subscribe

Subscribe to our e-mail newsletter to receive updates.

No comments yet.

Leave a Reply