Customer Support Centre : Manual : MySQL Databases : phpMyAdmin
Welcome to the phpMyAdmin section of the Efficient Hosting Support Manual where you will find information about all aspects of working with MySQL using phpMyAdmin.  
The links in this section are as follows;
Introduction To phpMyAdmin : The phpMyAdmin Welcome Screen : phpMyAdmin Built In Documentation
Adding Tables To Your Database : Adding Data To Tables : Running Queries On A Single Table
Running More Advanced Queries : Executing "Raw" Statements Through phpMyAdmin
Further Reading And Related Links
  Introduction To phpMyAdmin
phpMyAdmin is a powerful and user-friendly system for managing MySQL databases which can be conveniently accessed by clicking on the phpMyAdmin link near the bottom of the MySQL Databases menu. phpMyAdmin allows common operations such as the running of queries and the adding, deleting and modifying of tables and records to be performed using simple web-based forms. Alternatively, almost any "raw" MySQL command may be conveniently typed into a command box for processing.

Before using phpMyAdmin, you will first need to create at least one MySQL database to work with. For instructions on Creating A MySQL Database please refer to our more general MySQL documentation.

Return To Top of Page
  The phpMyAdmin Welcome Screen
Clicking on the phpMyAdmin link (see above) will take you to the phpMyAdmin Welcome Screen. You can return to this page at any time by clicking the Home link in the left-hand frame.

The Welcome Screen will appear similar to the one pictured on the right:
Welcome Screen

The right-hand frame contains several links. The phpMyAdmin Homepage link is a shortcut to the phpWizard website, an excellent resource for information related to the use of the phpMyAdmin application.

The phpMyAdmin documentation link is discussed in the next section.
phpMyAdmin website

Return To Top of Page
  phpMyAdmin Built In Documentation
The phpMyAdmin documentation link on the phpMyAdmin Welcome Screen can be used to access some very basic documentation on phpMyAdmin. This documentation is not very detailed and concentrates more on installing phpMyAdmin than actually using it. Consequently, this documentation is likely to be of only limited interest to most users.

More useful are the context sensitive [Documentation] links which are available in many of the phpMyAdmin sub-menus. These links will take you straight to the most relevant section of the MySQL Manual for the menu in which they appear.

Return To Top of Page
  Adding Tables To Your Database
When you initially create a MySQL database, you essentially create a blank database. In order to store any data in your database, you will first need to add one or more tables to it using the following procedure:

Database Name

Click on the database name in the left frame of the phpMyAdmin Welcome Screen.

The Database Administration Screen shown to the right will appear.

Create a new table by entering the table name in the Name field and the number of data fields which will be in the table in the Fields field. Select the Go button.

Database Administration Screen

The Field Set Up Screen will appear:

Field Set Up Screen

Enter the appropriate information to describe the data fields you are creating, then select the Save button.

The Table Administration Screen will appear, listing statistics about the table you have just created and offering ways of entering data into the table. This screen also includes various options for viewing, searching and updating the table.

Return To Top of Page
  Adding Data To Tables
After you have added at least one table to your database, a listing of all the tables within your database will appear beneath the database name in the left-hand frame: Database Name

Clicking on one of these table names will open the Table Administration Screen for this table in the right-hand frame:

Database Table Names

Records (or "rows") may be added to a table one at a time by clicking the Insert link, which you will find near the top of the page. Simply enter the required value for each field (and any functions to be applied to these values) into the Insert Screen and click Save to store the new record.

Alternatively, a number of new records may be added to a table in one go by uploading them from a text file. This can be done by clicking the Insert data from a textfile into table link, which you will find about half way down the page. For full instructions on using this feature, please refer to the Importing Data Into MySQL Tables section of our general MySQL documentation.

Return To Top of Page
  Running Queries On A Single Table
Once you have created and added data to your table(s), you need to be able to search and extract data from them by running "queries". When you query a database, MySQL returns the results from its data that match the criteria or search conditions that you specified in the query.

phpMyAdmin provides two user-friendly forms which make it easy to perform database queries without needing to write out the "raw" MySQL select statements:

The simplest, and so the easiest to use, of these forms is designed for running queries on a single table. To access this form, open the Table Administration Screen and click the Select link.

The Select Screen will appear:

There are two alternative ways to enter the search conditions on this screen. The most user-friendly of these is to use the "Query By Example" table to enter conditions for each field. This has been done in the example above, where a query has been set up for albums with the word "anthology" in the title which were recorded by groups with the word "beatles" in their name and released later than 1995. The % is a wildcard character that matches any string of characters.

We could instead have used the "Add Search Conditions" box to run the same query. To use this box it is necessary to enter the body of the "where" clause of the MySQL "select" statement. This is clearly not as user-friendly as the "Query By Example" method, and requires a little more knowledge of MySQL, but it does offer the advantage of greater flexibility.
Table Administration Screen

To run the above query using this method, we would need to enter the following into the search conditions box:
artist LIKE "%beatles%" AND album LIKE "%anthology%" AND year>1995

Please note that you can only use one or the other of these methods and not a combination of the two. If anything is entered in the "Add Search Conditions" box then any entries in the "Query By Example" table are simply ignored.

Finally, to run the query you have set up, click the Go button.

Return To Top of Page
  Running More Advanced Queries
phpMyAdmin also provides a more powerful Query By Example Screen for use when running more complex queries. This screen offers more fields for entering search conditions, allows the sorting of results and also supports the querying of multiple tables.

Often you will need to access more than one table at a time when querying a database. Returning to our pop group database example, you might have a separate table associating each group with a style of music. In order to extract a list of all "New Wave" albums, you would need to access both the albums database (to associate each album with a pop group) and the styles database (in order to know which groups are "New Wave") during a single query.

To access this screen, open the Database Administration Screen and click the Query By Example link.

The Query By Example Screen will appear:

You can select which tables are to be included in the query by ensuring that they (and only they) are selected in the Use Tables box. Accidentally including tables which shouldn't really be part of your query can result in the query result containing duplicate entries (the entire result set may be repeated for each record in the irrelevant table). Query By Example Screen

All of the fields which make up the tables being used can be selected from the drop-down boxes in the Field row. In addition to any fields to be returned by the query (which should have the Show box checked) it may also be useful to include additional fields to test against the search conditions. If you need more columns, either enter the number of extra columns required in the Add/Delete Field Columns box or check one or more of the Ins (Insert) boxes located underneath each column, and click Update Query.

The main search conditions for each field should be entered in the Criteria row in the appropriate column for the field to be tested. If additional search conditions are required for a given field/column, these can be entered in the additional row(s) below the main Criteria row. As with columns, more rows may be added using either the Add/Delete Criteria Row box or the Ins box(es) located to the left of the table.

The And/Or radio boxes to the left of each row may be used to control if the search conditions entered into a given row need to be satisfied as well as all the other conditions in the same column (And box checked) or as an alternative to the other conditions (Or box checked).
In a similar way, the And/Or radio boxes at the bottom of each column control how the conditions applied to each field are combined across columns. In the example above, they are all set to And as we require both the style to be "New Wave" and the artist having this style to match that of the album being considered.

The drop-down boxes in the Sort row may be used to sort fields in either ascending or decending order.

Once all the fields, drop-down boxes and check boxes have been correctly set up for your query, clicking the Update Query button will cause phpMyAdmin to automatically generate the "raw" MySQL code for your query. You should then be able to see the MySQL code displayed in the box located in the lower right-hand corner of the screen.

Finally, click the Submit Query button to execute the query.

Return To Top of Page
  Executing "Raw" Statements Through phpMyAdmin
From the Database Administration Screen, you can run queries against your database by typing "raw" MySQL select statements directly into the Run SQL Query/Queries box. This query box should only be used if you know how to write queries manually.

In fact, the same box can be used to run almost any "raw" MySQL statement without needing to establish a direct Encrypted Telnet (SSH) connection with the MySQL server.

Return To Top of Page
  Further Reading And Related Links
phpWizard website (home of phpMyAdmin):

Efficient Hosting general MySQL documentation:

Return To Top of Page
Home : Order : Plans & Prices : Domains : Demo : FAQ : Support : Feedback : Contact Us : Affiliates : Terms

Copyright © 2000-2004 Efficient Hosting. All rights reserved.
Reproduction in whole or in part is strictly prohibited.