PHP Interaction with a Database
Subject: Web development using PHP and MySQL
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 tealearn.org, 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.
RDBMS Product and Database
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.
Some people refers to MySQL, Oracle or MS SQL Server as database, while in the real sense this are just products using in creating and managing a database and not a database E.g MS Word is not a document, but a Microsoft office program use in creating documents. Therefore, 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 may 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 product use in creating and managing 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 for web apps. 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.
HOW THE DATABASE IS STRUCTURE
From the definition of database, I am sure it would be helpful to know some basics structures of relational database.
A relational 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 a graphical illustration (see 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) 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
By:
Benjamin Onuorah
Login to comment or ask question on this topic
Previous Topic Next Topic