If you are seeking hosting for your website, please contact qth.com where hosting includes a free SSL certificate and cPanel brand website control panel.

phpMyEdit Cheat Sheet tons of examples and links to .TXT files

Typical phpMyEdit field array:

$opts['fdd']['customer_number'] = array(
  'default'    => '',
  'help|ACP'   => 'Limit 10 digits',
  'input'      => '',
  'name'       => 'Customer Number',
  'options'    => 'ACPVDFL',
  'select'     => 'T',
  'size'       => 10,
  'sort'       => true
// If the tab feature is implemented, the first column must have a tab.
// Scripts are sometimes more readable if certain options are post-initialized:
// $opts['fdd']['customer_number']['tab|ACP'] = 'Customer Number';

Each field array can include display mode properties: 'options' => [A|C|P|V|D|F|I|L]

Add, Change, coPy, View, Delete, Filter, Initial sort suppressed, List.

List is assumed and technically does not have to be specified.

Input is normally empty, yet can be set to R or W or H (Read only, passWord, Hidden)

'input' => ''
'input' => 'R'

Anatomy of a field definition (fdd) for a TEXT/BLOB field:

$opts['fdd']['your_column_name'] = array(
 'default' => '', // BLOB fields won't have a default entry; the defined default for other column types often appears here
 'help|ACP' => 'Hello World', // Message appearing in the Help cell if the page mode is Add, Change, or coPy
 'input' => '', // Sometimes set as [R]ead-only, [H]idden, or [P]assword. Use R for virtual (dummy) fields.
 'maxlen|ACP' => 65535, // Field length defined in MySQL, could be used for input validation purposes
 'name' => 'Content', // Column label
 'options' => 'ACPVDFL', // Suppress [F]ilter by removing F, suppress [L]ist by removing L, suppress initial sorting by adding I
 'select' => 'T', // Filter (Search) box in List mode (set D for drop down, N for numeric range qualifiers, M for multiple SELECT)
 'sqlw' => 'TRIM("$val_as")', // Apply MySQL's trim() function to SQL write
 'strip_tags|FL' => true, // Usually true unless displaying HTML markup in which case false is typically applied
 'textarea' => array('rows' => '5', 'cols' => '80'), // Dimensions for the HTML TEXTAREA box
 'trimlen|FL' => 100, // In [F]ilter and [L]ist modes display only the first 100 characters
 'sort' => false // If set true, the column title is a sort link. BLOB fields should be false.

Post-initialized Javascript validation of a field named `col_name`:

$opts['fdd']['col_name']['js']['required'] = true; // Entry is required
$opts['fdd']['col_name']['js']['regexp'] = '/^[a-zA-Z]*$/'; // Optionally apply Javascript REGEX / regular expression
$opts['fdd']['col_name']['js']['hint'] = 'Entry of Content is required'; // Contents of the Javascript alert 

Field options ['fdd'] can be restricted to specific page modes (ACPVDFLI), for example: 'help|ACP' or 'trimlen|FL'.

Refrain from defining columns with a NULL value unless you have a specific reason for using NULL.

The following elements are available for use in a field definition arrays.

'colattrs' - user-defined table cell attributes: 'colattrs|FL' => 'style="color:#ff0000; background-color:transparent;"',

Given Bootstrap implementation in this project, if a column is unusually  
wide in List mode, then try setting colattrs to something like this:
'colattrs|FL' => 'style="width:100px"',
'css' - user-defined style class '-right-justify' is a form generator element, not a phpMyEdit element
'datemask' - applicable to TIMESTAMP(14) and DATETIME fields
'datemask' => 'Y-m-d H:i:s'
'datemask' => 'r'
'default' - default values are extracted from MySQL™ when the script is created.
// NULL values, if found, are handled using the 'sqlw' element.
'escape' - if set to true, htmlspecialchars() will be applied to data (set false to display HTML markup)
'help|ACP' - help / guidance displayed in ACP modes in a 3rd column (TD tag next to data)
'input' - Normally empty, applications are R, W, and H (Read only, passWord, Hidden)
R - indicates that a field is read only (TIMESTAMP or auto_increment)
W - indicates that a field is a password field
H - indicates that a field is to be hidden and marked as hidden
'mask' - a string (e.g. '%01.2f') used by sprintf() to format output (see also number_format)
'maxlen' - maxlength attribute in the display of INPUT boxes relating to add/edit/search
'name' - title for column headings ... PHP's ucwords(strtolower(col_name))
'nowrap' - HTML NOWRAP attribute for TD tags
'number_format' emulates PHP's number_format() function
'options' - ACPVDFLI - optional parameter to control whether a field is displayed:
A - add
C - change
P - copy
D - delete
V - view
F - filter
L - list
I - initial sort suppressed
'php' - If the 'php' option is set, a file of that name is included (and executed) in place of a value.
Behavior is the same as the triggers feature.
'required' - true or false (true invokes javascript to prevent null entries)
Do not use quotation marks (") within the 'hint'.

The above post-initialization example may be easier to work with than the following examples which might be applied directly to a field options array.

'js' => array(
  'required' => true,
  'regexp' => '/^[0-9]*$/',
  'hint' => 'Please enter only numbers 0-9 in the col_name field.'
'select' - HTML INPUT/SELECT box type used for filtering records.
T - text
N - numeric (=, <=, =>)
D - drop-down
 - multiple selection
Defining fields as ENUM or SET in MySQL™ will result in HTML SELECT boxes in Filter mode.
'size' - size attribute applied to HTML INPUT boxes
'strftimemask'  optinally applied to INT fields containing a Unix timestamp
'strftimemask' => '%c',
'strftimemask' => '%a %m-%d-%Y %H:%M %p',
'sort' - In List mode, if set to true, the column header is a clickable link that
enables column sorting. BLOB columns should usually be set to false.
'sql' - see documentation, examples follow
'sql|FLV' => 'if($col_name > "", CONCAT(DATE_FORMAT($col_name, "%a %b %e %Y %h:%i %p")), "")',
'sql|FLV' => 'if(FirstName <> "", CONCAT(LastName, ", ", FirstName), LastName)'
'sql|FLV' => 'if(start_date > "", CONCAT(start_date, "%b %e %Y - %a"), "")'
'sql|LV'  => 'CONCAT(FROM_UNIXTIME(col_name, "%a %b %e %Y %h:%i %p"))',
'sql|LV'  => 'if(FirstName <> "", CONCAT(LastName, ", ", FirstName), LastName)',
'sql|LV'  => 'if(start_date > "", CONCAT(start_date, "%b %e %Y - %a"), "")',
'sql'     => 'CONCAT(FROM_UNIXTIME(col_name, "%a %b %e %Y %h:%i %p"))'
'sqlw' => 'IF($val_qas = "", NULL, $val_qas)'
'sqlw' => 'TRIM(UPPER($val_as))'
'strip_tags' - apply PHP's strip_tags($col_name)
'tab|ACP' - If tabs are enabled in the $opts['display'] array, apply clickable Javascript tabs
(sub-forms) appear in ACP modes. Apply to column 0 and one (or more) additional fields.
'textarea' - rows/cols attribute for HTML TEXTAREA boxes
'trimlen|FL' - number of characters to display in [F]ilter and [L]ist modes (often applied to BLOB/TEXT fields)
'URL' - used to make a field 'clickable' in the display
for email addresses: 'mailto:$value'
where the value might be www.domain.com: 'http://$value'
where the value might be http://www.domain.com: '$value'
'URLtarget' - HTML A HREF target parameter, e.g.  'target="_blank"'
'values' - $opts['fdd']['col_name']['values'] = array('0', '1', '2', '3');
'values2' - $opts['fdd']['col_name']['values2'] = array('0' => 'No', '1' => 'Yes'); 

Notification examples:

$opts['notify']['from']   = 'user@domain.com';
$opts['notify']['prefix'] = $_SERVER['REQUEST_URI'].' - ';
$opts['notify']['wrap']   = '72';
$opts['notify']['all']    = 'user@domain.com'; // events: insert, update, delete
$opts['notify']['delete'] = 'user@domain.com'; // event: delete
$opts['notify']['insert'] = 'user@domain.com'; // event: insert
$opts['notify']['update'] = 'user@domain.com'; // event: update 

Native MySQL™ functions are supported, including CONCAT & REPLACE.

$opts['fdd']['dummy2'] = array (
   'name' => 'Thumbnail',
   'sql|VLF' => 'if(category = "other",
      CONCAT("<a href=\"", dir, "/", filename, "\" target=\"_blank\">link</a>"),
         if(category = "thumb", CONCAT("<a rel=\"example_group\" href=\"", REPLACE(dir, "/tn", "/"), filename, "\" target=\"_blank\"><img src=\"", dir, "/", filename, "\" ", " alt=\"\" border=\"0\"></a><br><a href=\"fancybox.change.php?upld_id=", upld_id, "\">Replace</a>"), ""))',
   'options'  => 'VLF',
   'input'  => 'R',
   'escape' => false,
   'sort'     => false

Task specific phpMyEdit cheat sheets (code clips) are listed on the right side of the phpMyEdit Cheat Sheet page.

phpMyEdit Documentation

See also English Documentation (Slovakia)

Naming conventions for MySQL™ columns, tables, and databases

While the hyphen (-) may be a valid character in the names of databases, tables, and columns, don't use a hyphen. Use of hyphens in the name of a database, table, or column may cause problems. If a hyphenated resource name appears in a double-quoted string of PHP code, the hyphen will be interpreted as a minus sign and crash the script.

Varied system configurations may cause portability issues if upper case letters are used when naming MySQL™ resources. Use lower case letters to ensure portability to other system configurations. Lower case letters a-z, numeric digits 0-9, and the underscore character are preferred by most users. If using upper case letters, your code might not be portable to a different server, most notably when migrating from Linux to Windows.

Avoid using Reserved Words when naming columns, tables, and databases.

Consider using the underscore character in your column names, e.g. first_name and not FirstName or firstname. Subsequently in PHP scripts the underscore can be easily replaced with a space when displaying the column name in reports.

Prefix the names of your tables with your initials and the underscore character, or another arbitrary prefix. Later on, if you install a different web application in the same database, the possibility of table name conflict is significantly reduced.

NULL values

The only time I've found it practical to store a NULL value in a MySQL™ table occurs with DATE type columns, where the date entry is either unknown or optional. Otherwise, it makes no sense to me to store NULL when storing an empty string conserves bytes and avoids adding complexity to subsequent queries for that field. Always assign the field attribute NOT NULL unless you have a specific reason for inserting NULL values.

UTF8 Collation and Connection with MySQL™ Improved Connection Method

Specifying a database collation as UTF8_GENERIC_CI, using appropriate META tags, and issuing queries for SET NAMES UTF8 and SET COLLATION_CONNECTION=UTF8_GENERAL_CI after the database connection seems to work well for web pages which may contain accented characters. English language users will do well with UTF8_GENERAL_CI. Other languages might best be handled using UTF8_UNICODE_CI. See this collation discussion thread.

Forcing UTF-8 Connections in MySQL™ 5.x or higher can potentially be accomplished using a statement in the my.cnf file calling init_connect.

With UTF8, you also need to be sure to apply the appropriate HTML META tags to your document.

HTML 5 (this project)

<meta charset="UTF-8">

HTML 4 (legacy)

<meta http-equiv="charset" content="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

Links to phpMyEdit documentation on opensource.platon.sk

Unique key
opts key
opts key_type
Common options
opts page_name
opts inc
opts multiple
opts display ( form, num_pages, num_records, query, sort, tabs, time )
opts url (images)
opts execute (1)
Permission options
opts options ACPVDFLI
Add, Change, coPy, View, Delete, Filter, Initial sort suppressed
opts sort_field one field name or an array of field names
Navigation and buttons
opts navigation
opts buttons
opts filters
opts triggers
Logging user actions
opts logtable
opts notify
opts language possible footer links to alternate language selections
CGI variables
opts cgi append
opts cgi overwrite
opts cgi persist
opts cgi prefix
Javascript and DHTML
opts dhtml
opts js
CSS classes policy
opts css - prefix page_type position divider separator
Fields options
fdd overview
Basic field options
fdd css
fdd help|ACP ucwords/upper/lower
fdd input
fdd name ucwords/upper/lower
fdd options ACPVDFLI, field type, auto_increment, timestamp, by name, etc
fdd select SET, ENUM, T, N
fdd escape is generally only set true if the field contains HTML markup
fdd sort is generally set false if the column type is TEXT/BLOB
fdd strip_tags false by default
sometimes strip_tags|LF => true is preferable 
if the field contains HTML markup
JavaScript validation
fdd js required [be sure to define a hint]
fdd js regexp [0-9] is conditionally applied herein to column type INT
fdd js hint generally omit auto_increment, NULL; problematic if applied to all fields
Input restrictions
fdd values
fdd values lookup
fdd values2
Output control
fdd colattrs
fdd cols textarea
fdd datemask
fdd mask
fdd maxlen
fdd nowrap
fdd number_format
fdd rows textarea
fdd size|F
fdd strftimemask
fdd trimlen|ACP
URL linking
fdd URL
fdd URLdisp
fdd URLprefix (legacy)
fdd URLtarget
SQL expressions
fdd sql
fdd sqlw
fdd sqlw MD5
PHP expressions
TABs feature
fdd tab
Options variability
fdd trimlen
fdd trimlen|LF