HomePHP Page 2 - Changing Table Structure in phpMyAdmin
Editing Field Attributes - PHP
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).
On the Structure sub-page, we can make further changes to our table. For this example, we have set $cfg['PropertiesIconic'] to 'both' to see both the icons along with their text explanation:
This panel does not allow every possible change to fields. It specifically allows:
Changing one field structure, using the Change link on a specific field
Removing a field: Drop
Adding a field to an existing Primary key
Setting a non-unique Index or a Unique index on a field
Setting a Fulltext index (offered only if the field type allows it)
These are quick links that may be useful in specific situations. Keep in mind that they do not replace the full index management panel, or the full field structure panel. Both are explained in this chapter.
We can also use the checkboxes to choose fields, and with the appropriate With selected icons, Edit the fields or do a multiple field deletion with Drop. The Check All / Uncheck All option permits us to easily check or uncheck all boxes.
TEXT Fields
We will now explore how to use the TEXT field type and the relevant configuration values to adjust for the best possible phpMyAdmin behavior.
First we add a TEXT field called description:
There are three parameters that control the layout of the text area that will be displayed in Insert or Edit mode for the TEXT fields.
First, the number of columns and rows for each field is defined by:
This gives (by default) the following space to work on a TEXT field:
The settings do not impose a limit other than visual, and a vertical scroll bar is created by the browser, should it be necessary.
Although MEDIUMTEXT, TEXT, and LONGTEXT columns can accommodate more than 32K of data, current browsers cannot always edit them with the mechanism offered by HTML: a text area. In fact, experimentation has convinced the phpMyAdmin development team to have the product display a warning message if the contents are larger than 32K, telling users that it might not be editable.
For LONGTEXT fields, setting $cfg['LongtextDoubleTextarea'] to TRUE doubles the available editing space.
This 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.