Databases Reference
In-Depth Information
Preserving the original formatting
Normally, when displaying text, phpMyAdmin escapes special characters. For
example, if we entered
This topic is <b>good</b>
in the
description
column for one
book, we would normally see
This book is <b>good</b>
when browsing the table.
However, if we used the transformation
text/plain: formatted
for this column, we
would get the following output while browsing:
In this example, the results are correct. However, other HTML tags entered in the
column could produce surprising results (including invalid HTML pages). For
example, as phpMyAdmin presents results using HTML tables, a non-escaped
</table>
tag in the column would ruin the output.
Displaying parts of a text
The
text/plain: substr
transformation is available for displaying only a portion
of the text. The following are the options:
• Where to start in the text (default: 0)
• How many characters (default: all of the remaining text)
• What to display as a sufix to show that truncation has occurred; the default
is to display ellipses (...)
Remember that
$cfg['LimitChars']
is doing a character truncation for every non-
numeric column. Hence,
text/plain: substr
is a mechanism for fine-tuning this
column by column.
Displaying a download link
Let us say we want to store a small audio comment about each book inside MySQL.
We add a new column to the
book
table, with the name
audio_contents
, and type
MEDIUMBLOB
. We set its
MIME type
to
application/octetstream
and choose the
application/octetstream: download
transformation. In the
Transformation
options
,
we insert
'comment.wav'
.
This MIME type and extension will inform our browser about the incoming data,
and the browser should open the appropriate player. To insert a comment, we first
record it in a
.wav
format, and then upload the contents of the file into the
audio_
contents
column for one of the topics. When browsing our table, we can see a link
comment.wav
for our audio comment:
Search WWH ::
Custom Search