PHP Interaction with a Database

Today, you can’t talk about web development without talking about database backend, because web has being the best platform for sharing or disseminating information and database it the largest and most structure option for storing data in its largest or unlimited form.

Let’s consider for example that we want to send an email or updates to all those who have sent us a feedback, if you had only sent the feedback to an email I’m sure you won’t be able retrieve this easily, unless you start opening every email to collect their email addresses but with a database you don’t have to go through all this hustle.

Beside virtually every website or application you can think of are all database-driven such as my Online art gallery;, facebook, twitter and others, so the mastering of a basic or deep database knowledge is a prerequisite for being a good web developer, and this is something that interesting me about web development, it require these array of knowledge from project management to information design, programming and database development, although if you work in a large organization that is well-to-do  they may require separate professionals to handle each of this areas.

So as we start using PHP with MySQL, we will start with a basic database introduction so that we can deal with some database term such as RDBMS, Database, Tables, SQL, among others.     



Although there are too many books that treat this topic in more detail, but to make things easier for you I’ve decided to give a quick intro.

 Most IT professionals and not IT people always refer to MySQL, Oracle or MS SQL Server as database, while in the real sense this are just products and not a databases, these are mere products own by their respective vendors or community, because according to the Microsoft Computer dictionary, Fourth Edition. Database is define as a file composed of records, each containing fields together with a set of operations for searching, sorting, recombining, and other functions.  This means that a database is simple a structured collection of related data, records or information. For example a database of a company can keep records of employee, products, customer and many other related records.  So what can we call MySQL then?

MySQL just like others, is actually a Relational Database Management System (RDBMS) while studying Computer science at the college, I learnt that they are different types of database management technologies, but from my practical knowledge I’m sure that the RDBMS is most popular and widely used. So what is the relationship between RDBMS and Database?  A simple illustrated answer to this is the cake pan and the cake, you don’t eat the cake pan but you use it to produce the cake that you actually eat. Although RDBMS and Database may be more related; apart from using a RDBMS such as MySQL to create a Database, you still need it to manage or administer it, I believe this is one of the reasons why most people can hardly differentiate between this two because I’m sure most of the people using this technology have not really seen their database file on a physical location other than through the RDBMS administrative environment.



From the definition of database, I am sure it would be helpful to know some basics structures of database.

First a database is mainly made up tables, a table can contain one or more fields and these tables hold or store independent records using these fields.

However a record can be seen as a row made up data about one particular entity.

To understand this better I took time to create the illustration of Bengallery Info Tech database structure below.




Although we create and manage a database using a RDBMS such as MySQL, which offer several administrative environments such as the console interface or the windows based MySQL workbench or even the more popular browser-based PhpMyAdmin (which we will be using later) which makes your interaction with the database easier, without necessarily using a Structured Query Language (SQL) for everything. SQL is the standard language for interacting with a relational database.

However as a web developer it is mandatory you have basic knowledge SQL, because you will be writing SQL query within your PHP program.  

Please note, don’t confuse, MySQL with SQL, as explained earlier the former is a Relational Database Management System (RDBMS) while the later is a query language, which according to standard can be use to query or interact with any relational database, either Oracle, PostgreSQL, MS SQL Server or MySQL database


To explore the PHP and MySQL database integration, we will be creating another version of the feedback system, this time the submitted feedback will be stored in a database then we will learn some common interaction we may have with this records in our database.


Next »

Home    |    Learn Programming   |    Learning Management System   |    Computer Based Testing System    |    Contact Us