Home arrow PHP arrow Changing Table Structure in phpMyAdmin

Changing Table Structure in phpMyAdmin

This chapter explores editing table definitions and using special column types. When developing Web applications (or any application), requirements often change because of new or modified needs. Developers must accommodate these changes through judicious table-structure editing. This is chapter six of Mastering phpMyAdmin for Effective MySQL Management by Marc Delisle (Packt Publishing, April 2004, ISBN 1904811035).

TABLE OF CONTENTS:
  1. Changing Table Structure in phpMyAdmin
  2. Editing Field Attributes
  3. BLOB (Binary Large Object)
  4. ENUM and SET
  5. Index Management
  6. Multi-Field Indexes and Index Editing
  7. Table Optimization: EXPLAIN a Query
By: Marc Delisle
Rating: starstarstarstarstar / 21
September 28, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

phpMyAdminAdding a Field

Suppose we need a new field to store a book's language, and by default, the books on which we keep data are written in English. We decide that the field will be called language, and will be a code composed of two characters (en by default).

In the Structure sub-page of the Table view for the books table, we can find the Add new field dialog. Here, we specify how many new fields we want and where the new fields go.

The positions of the new fields in the table only matter from a developer's point of view; we usually group the fields logically to find them more easily in the list of fields. The exact position of the fields will not play a role in the intended results (output from the queries), because these results can be adjusted regardless of the table structure. Usually, the most important fields (including the keys) are located at the beginning of the table, but this is a matter of personal preference.

In this case, we choose to put the new field At End of Table, which is the first choice in the menu, and click the Go button:

phpMyAdmin

We then see the familiar panel for the new fields, repeated for the number of fields asked for. We fill it, and this time we put a default value, en. We then click on Save.

phpMyAdmin

This panel appeared in horizontal mode, the default for $cfg['DefaultPropDisplay'].

Vertical Mode

If we set $cfg['DefaultPropDisplay'] to 'vertical', the panel to add new fields (along with the panel to edit a field's structure) will be presented in vertical order. The advantages of working in vertical mode become obvious especially when there are more choices for each field, as explained in Chapter 16 on MIME-Based Transformations.

Let's see how the panel appears if we are in vertical mode and ask for three new fields:

phpMyAdmin

phpMyAdminThis chapter is from Mastering phpMyAdmin for Effective MySQL Management by Marc Delisle (Packt Publishing, April 2004, ISBN 1904811035). Check it out at your favorite bookstore today.

Buy this book now.



 
 
>>> More PHP Articles          >>> More By Marc Delisle
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: