Chapter 3. General options

Open the script in your text editor. No HTML header or footer is created, thus you may want to include a header at the top of the script, and include a footer at the end of the script.

3.1. Database connection

Various options are configured near the top of the script, most notably the database logon. For security reasons, you may want to copy/paste the logon options to a separate, included file.

MySQL logon options host name, user name, password, database, and table appear in the following format.

Example 3-1. Database connection options

$opts['hn'] = 'localhost'; 
$opts['un'] = 'username'; 
$opts['pw'] = 'password'; 
$opts['db'] = 'database'; 
$opts['tb'] = 'table';

Recommended usage is, that the first four options shown above should be moved to a separate, included file.

It is a rather common situation to use phpMyEdit inside larger project. To prevent phpMyEdit from creating an additional persistent database connection, supply the $opts['dbh'] option. In the example below, $your_project_db_handle represents a previously allocated MySQL database handle. When $opts['dbh'] is specified, the first four options appearing above are ignored.

Example 3-2. Supplying allocated connection

$opts['dbh'] = $your_project_db_handle;

Bootstrap phpMyEdit PHP Form Generator