We are searching data for your request:
Upon completion, a link will appear to access the found materials.
New website owners often stumble at the mention of database management, not realizing how much a database can enhance a website experience. A database is just an organized and structured collection of data.
MySQL is a free open source SQL database management system. When you understand MySQL, you can use it to store content for your website and access that content directly using PHP.
You don't even need to know SQL to communicate with MySQL. You just need to know how to operate the software that your web host provides. In most cases that is phpMyAdmin.
Before You Begin
Experienced programmers might choose to manage data by using the SQL code directly either through a shell prompt or through some sort of a query window. New users are better off learning how to use phpMyAdmin.
It is the most popular MySQL management program, and almost all web hosts have it installed for you to use. Contact your host to find out where and how you can access it. You need to know your MySQL login before you begin.
Create a Database
The first thing you need to do is create a database. Once that is done, you can start adding information. To create a database in phpMyAdmin:
- Log in to your account at your web hosting site.
- Locate and click the phpMyAdmin icon and log in. It will be in your website's root folder.
- Look for "Create New Database" on the screen.
- Enter the database name in the field provided and click Create.
If the create database feature is disabled, contact your host to create a new database. You must have permission to create new databases. After you create the database, you are taken to a screen where you can enter tables.
In the database, you can have many tables, and each table is a grid with information held in cells on the grid. You need to create at least one table to hold data in your database.
In the area labeled "Create new table on database your_database_name," enter a name (for example: address_book) and type a number in the Fields cell. Fields are columns that hold information.
In the address_book example, these fields hold first name, last name, street address and so on. If you know the number of fields you need, enter it. Otherwise, just enter a default number 4. You can change the number of fields later. Click Go.
In the next screen, enter a descriptive name for each field and select a data type for each field. Text and number are the two most popular types.
Now that you have created a database, you can enter data directly into the fields using phpMyAdmin. Data in a table can be managed in many ways. A tutorial on ways to add, edit, delete, and search the information in your database gets you started.
The great thing about MySQL is that it is a relational database. This means the data from one of your tables can be used in conjunction with data on another table as long as they have one field in common. This is called a Join, and you can learn how to do it in this MySQL Joins tutorial.
Working From PHP
Once you get the hang of using SQL to work with your database, you can use SQL from PHP files on your website. This allows your website to store all its content in your database and access it dynamically as needed by each page or each visitors request.