phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options

Web Development with PHP and MySQL

Dynamic, database-driven small business web sites done right.    
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options

Try Firefox



See also
phpvs.com

 

phpMyEdit Configuration Options

So much information on phpMyEdit was compiled that the php-form-generator.com web site was created in 2006.

Below are some older examples of filters for phpMyEdit forms. Variables used in most filters can be passed from another form, or from a link included in the page footer.

<a href="my_form.php?ltr=A">A</a>

In the requested form, process the variable and make it persistent across various page modes (Next, Previous, Search, Cancel).

$ltr = @$_REQUEST['ltr'];

$opts['cgi']['persist'] = array('ltr' => $ltr );

$opts['filters'] = 'company REGEXP "^'.$ltr.'"';

In the following example, a sessions script passes $valid_user. Also, a column named valid_user exists in the database table. Only those records accessible to $valid_user and fictitious user 'public' will be displayed using the following filter.

$opts['filters'] = 'valid_user = "'.$valid_user.'" OR valid_user = "public"';

$opts['cgi']['persist'] = array('valid_user ' => $valid_user );

The following example configures a persistent table level filter for one record id passed to the requested form using <a href="my_form.php?ltr=A&operation=View&id=1">ID #1</a>. This record remains filtered even if user clicks Cancel to leave View mode.

array_key_exists('id',$_GET) ? $id = $_GET['id'] : $id = $rec;

$opts['cgi']['persist'] = array('id' => $col_name);

$opts['filters'] = $id > 0 ? "col_name = '$id'" : '';

The following is a template for configuring different filters based on the numeric value associated with a variable named $xfl which is passed to the requested form through a link from another page, or from a link in the page footer.

$xfl = @$_REQUEST['xfl'];

if($xfl > 0){
   $opts['cgi']['persist'] = array('xfl' => $xfl);
}

switch($xfl){
   Case 1:
      $opts['filters'] = ''; // edit
      break;
   Case 2:
      $opts['filters'] = ''; // edit
      break;
   Case 3:
      $opts['filters'] = ''; // edit
      break;
   Case 0:
   default:
      break;
}

The database connection is closed by phpMyEdit.class.php. Thus, in order to run separate database queries in the page footer you need to reopen a connection or comment out $this->disconnect(); in the class file.

With PHP in general, declaring configuration variables using an array format like $opts['db'] for the database name has advantages over using a format like $db and $hn. For example, when variables are required by a function, you merely need to call global $opts; instead of global $db, $un, $pw, $hn;.

phpMyEdit requires the first column in the database table contain unique data, thus it is wise to always define MySQL™ column 0 as a numeric autoincrement column.

phpMyEdit PHP Form Generator Demo at php-form-generator.com

Additional information is available at the phpMyEdit Forum.

 

phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options
phpMyEdit Configuration Options

web hosting