phpSuperDB database management tool vers. 1.00

What is it?

This is a quite simple tool for browsing, searching database table, adding, editing and deleting records from table. Of course, one may use phpMyAdmin, but it's not a tool for an old lady to store information about incoming mail and documents. And up to date it's a very quick, efficient and simple and yet quite sufficient solution to many storing and searching data tasks.

Features

Installation

Create a separate database for use by the phpSuperDB. The structure:
CREATE TABLE SuperDBHistory (
  h_table varchar(64) NOT NULL default '',
  h_date datetime NOT NULL default '0000-00-00 00:00:00',
  h_user varchar(16) NOT NULL default '',
  h_event varchar(255) NOT NULL default '',
  h_ip varchar(16) NOT NULL default ''
);
CREATE TABLE Metainformation (
  mi_table varchar(64) NOT NULL default '',
  mi_created datetime NOT NULL default '0000-00-00 00:00:00',
  mi_creator varchar(16) NOT NULL default '',
  mi_modified datetime NOT NULL default '0000-00-00 00:00:00',
  mi_modifier varchar(16) NOT NULL default '',
  mi_user_IP text NOT NULL,
  mi_admin_IP text NOT NULL,
  mi_html_header text NOT NULL,
  mi_fields text NOT NULL,
  mi_database_name varchar(255) NOT NULL default '',
  mi_table_name varchar(255) NOT NULL default '',
  mi_per_page int(11) unsigned NOT NULL default '50',
  mi_admins text NOT NULL,
  mi_foreign_keys text NOT NULL,
  mi_usermaydelete enum('0','1') NOT NULL default '0',
  PRIMARY KEY  (mi_table)
);
Then create a separate user to access this database. That's all. Generally you want all your scripts to share the same database to store phpSuperDB setup.

Make first run

Your first simple script will look like:

<?
    
require_once("superdb.lib.php");
    new 
SuperDB ("localhost","SuperDB","superdb","34534password234234",
                 
"localhost","Documents","Mail");
    
SuperDB::start_engine();

?>

The first row represents access parameters to your meta database. The second row - hostname, database name, table name.

Table setup

After the first user logs in engine automatically creates new record in Metainformation table that will hold all setup. There are two kinds of users: users and admins. By default all are admins. Admins are granted special abilities: edit table setup, view history and depending on setup deletion of rows in database.

General table setup:

Field setup:

Multiple tables

There is a nice solution to edit several tables in one database using one script instead of creating multiple scripts. Example:

<?

require_once("superdb.lib.php");

new 
SuperDB ("localhost","SuperDB","superdb","1234password123123",
             
"localhost","SomeDatabase","FirstTable");
new 
SuperDB ("","","","","","","SecondTable");
new 
SuperDB ("","","","","","","ThirsTable");
new 
SuperDB ("","","","","","","FourthTable");

SuperDB::start_engine();

?>

In this case the script when given empty parameters will take the real one from the first object created. The class constructor automatically creates and fills global array of object references. When multiple tables are used the default screen will be selecting table and the new menu button will appear to select table. Current table index is stored in session.

Documentation

Class constructor:
<?
    
function SuperDB ($metahost,$metadatabase,$metausername,$metapassword,
                      
$host,$database,$table,$tableuniquename="",$lang="en");
?>

It is all obvious. An empty any of first six parameters will make use of first created object. Empty $tableuniquename will default to $table.

The last parameter specifies that superdb.lang.en.php file will be included in the same directory where superdb.php script resides. To make it in your own language just copy this file to superdb.lang.something.php and edit it, then use "something" as the last parameter.

Method start_engine();:
<?
    
function start_engine($defaultindex=0);
?>

The only parameter defines index of table which will be used by default.

API

With phpSuperDB you can use the following features.

TODO