Best Web Host

phpMyEdit example

MySQL™ table editor

Filename: phpvs_sakila.actor.php

Page: 1 of 21  Records: 203
Actor ID First Name Last Name Last Update
Clear Sorted By: Actor ID ascending
View Change Copy Delete 4 JENNIFER DAVIS 2006-02-15 04:34:33
View Change Copy Delete 5 JOHNNY LOLLOBRIGIDA 2006-02-15 04:34:33
View Change Copy Delete 7 GRACE MOSTEL 2006-02-15 04:34:33
View Change Copy Delete 8 MATTHEW JOHANSSON 2006-02-15 04:34:33
View Change Copy Delete 9 JOE SWANK 2006-02-15 04:34:33
View Change Copy Delete 11 ZERO CAGE 2006-02-15 04:34:33
View Change Copy Delete 12 KARL BERRY 2006-02-15 04:34:33
View Change Copy Delete 13 UMA WOOD 2006-02-15 04:34:33
View Change Copy Delete 14 VIVIEN BERGEN 2006-02-15 04:34:33
View Change Copy Delete 15 CUBA OLIVIER 2006-02-15 04:34:33
Page: 1 of 21  Records: 203

Tables containing more than 'n' columns are configured to display the first 'n' columns and display links to toggle (add/remove) the remaining columns.

Users are advised to use phpMyAdmin to set an INDEX for columns which are often sorted/searched. Most web hosts provide phpMyAdmin in the website control panel.

Try Hostgator.com for excellent web hosting with cPanel, PHP, MySQL™ and many other features. cPanel PHP MySQL web hosting


phpMyEdit code created for the above table.

<?php

/*
 * Database: phpvs_sakila
 * Table: actor
 * Row count: 202
 * Column count: 4
 * Filename: phpvs_sakila.actor.php
 * Created Wed, 22 Feb 2012 22:39:47 -0700
 * Primary key: actor_id
 * Multi-key fields: last_name
 * All fields: actor_id, first_name, last_name, last_update
*/

$opts['tb'] = 'actor';

// phpMyEdit common variables + a few functions + UTF8 database connection

require_once('./resources/inc/config.php');

require_once(
'./resources/inc/header.php');

// Use phpMyAdmin to apply an INDEX to columns which are frequently sorted/searched.
// Prepending a minus sign (-) to a sort_field value causes DESCending sort order.

$opts['sort_field'] = array('actor_id');

$opts['key'] = 'actor_id';

$opts['key_type'] = 'int';

$opts['options'] = 'ACPVDFL';

// $opts['triggers']['insert']['after'] = 'resources/inc/triggers/view_rec_after_add.php';

if(empty($list_mode_status)){
   
// List mode
}elseif(isset($_REQUEST['PME_sys_operation']) || isset($_REQUEST['PME_sys_moreadd']) && isset($_REQUEST['PME_sys_morechange'])){
   
// 7 diffenent button clicks may occur
   // PME_sys_operation: Add, PME_op_Change, PME_op_Copy, PME_op_Delete, PME_op_View
   // PME_sys_moreadd: More
   // PME_sys_morechange: Apply
}

// Toggle preference disabled given only 4 columns


// Begin phpMyEdit field arrays

// column 0: `actor_id` int - smallint(5) unsigned
// flags: auto_increment, not_null, primary_key, unsigned
// extra: auto_increment
$opts['fdd']['actor_id'] = array(
  
'css'        => array('postfix' => 'right-justify'),
  
'default'    => '',
  
'input'      => 'R',
  
'name'       => 'Actor ID',
  
'options'    => 'VCDFL',
  
'select'     => 'T',
  
'size'       => 5,
  
'sort'       => true
);
// If the tab feature is implemented, the first column must have a tab
// $opts['fdd']['actor_id']['tab|ACP'] = 'Actor ID';


// column 1: `first_name` string - varchar(45)
// flags: not_null
// collation: utf8_general_ci
$opts['fdd']['first_name'] = array(
  
'default'    => '',
  
'help|ACP'   => 'Limit 45 characters',
  
'input'      => '',
  
'maxlen'     => 45,
  
'name'       => 'First Name',
  
'options'    => 'ACPVDFL',
  
'select'     => 'T',
  
'size'       => 45,
  
'sqlw'       => 'TRIM("$val_as")',
  
'sort'       => true
);
$opts['fdd']['first_name']['js']['required'] = true;
$opts['fdd']['first_name']['js']['hint'] = 'An entry is required for First Name';


// column 2: `last_name` string - varchar(45)
// flags: multiple_key, not_null
// collation: utf8_general_ci
$opts['fdd']['last_name'] = array(
  
'default'    => '',
  
'help|ACP'   => 'Limit 45 characters',
  
'input'      => '',
  
'maxlen'     => 45,
  
'name'       => 'Last Name',
  
'options'    => 'ACPVDFL',
  
'select'     => 'T',
  
'size'       => 45,
  
'sqlw'       => 'TRIM("$val_as")',
  
'sort'       => true
);
$opts['fdd']['last_name']['js']['required'] = true;
$opts['fdd']['last_name']['js']['hint'] = 'An entry is required for Last Name';


// column 3: `last_update` timestamp
// flags: binary, not_null, timestamp, unsigned, zerofill
// extra: on update CURRENT_TIMESTAMP
$opts['fdd']['last_update'] = array(
  
'css'        => array('postfix' => 'right-justify'),
  
'default'    => '',
  
'help|ACP'   => 'Timestamp',
  
'input'      => 'R',
  
'maxlen'     => 19,
  
'name'       => 'Last Update',
  
'options'    => 'VDFL',
  
'select'     => 'N',
  
'size'       => 19,
  
'sqlw'       => 'TRIM("$val_as")',
  
'sort'       => true
);
$opts['fdd']['last_update']['js']['required'] = true;
$opts['fdd']['last_update']['js']['hint'] = 'An entry is required for Last Update';

require_once(
'./resources/inc/phpMyEdit.class.new.php');

new 
phpMyEdit($opts);

require_once(
'./resources/inc/footer.php');

?>


cPanel PHP MySQL web hosting

If you have pre-purchase questions, please call Doug Hockinson at (720) 334-7850 or send email to doug@hockinson.com.

Data used for this demo is a modified version of Sakila schema (converted to MyISAM type tables)

Related sites: php-form-generator.com | phpvs.com | hockinson.com | denvermetro.org

Content management system with built in photo galleries and phpMyEdit form generator: www.phpvs.com/cms2011/

Regarding the style sheet used by these scripts, un-comment some CSS code for body and wrapper in order to match the layout of the generator script.

In page modes Add, Change, and coPy, note the Help text displayed beside the fields. Several configurable options are available: character limit, link to Help popup, code supplied but commented out (no value), display "Entry Required", or MySQL Column Comment.