BrowseEdit Class V4.1 Readme

Last update 3/1/2006

This class displays results of sql statements in a browseable and editable format akin to a MSAccess desktop display.

Version 4.1 adds database abstraction via the PEAR DB class. Please read about PEAR DB http://pear.php.net/manual/en/package.database.db.php. You can access database types other than MySQL by changing the database type variable. The simple connection functions included in the example scripts should be altered per the connection to be used, but will work in most cases. MySQL functionality remains the default and the class remains backwards compatable. Use the dbconnect() function for MySQL and dbconnectPEAR() for PEAR abstraction. The examples have been reworked to include the PEAR abstraction methods. This is not required if using MySQL methods in legacy scripts. Please review dbFunctions.inc to see the abstracted method code and PEAR DB Functions to examine the BrowseEdit implementation.

IMPORTANT: The identification of UID's for multiple tables has been changed. Please do not use the set_multiTable function. Instead set the column type attribute 'primaryKey' to TRUE. Multiple identical field names are now supported but must be distinguished using tablename.fieldname syntax. It is recommended to use tablename.fieldname syntax for all field references whether or not identical field names exist. In any case, do not mix syntax in the calling script.

IMPORTANT: Due to HTML limitations and addition of multiple tables, the HTML element name syntax has been changed to use 'table~field'. HTML will not post '.' so the ~ has been used as a delimiter instead. If you use HMTL element names in your scripts (Javascript,etc) then you will need to use the table~field syntax when referring to them. You should still use the table.field syntax in columnType and SQL instances.

Filtering has now been included in class. You can access filtering by <CTRL> clicking on the column header. A filter row with a dropdown of column distinct values will appear. Selecting a value will filter the result on that value. Turn off filtering by selecting __Filter Off__ in the dropdown.

Installation of PEAR DB: If you don't have PEAR installed please install PEAR per the PEAR website instructions. Make sure you include the path to the PEAR installation in your php.ini file. Install DB in the BrowseEdit directory. You will see a file DB.php and a folder DB.



Following the last major update (version 3) that was a result of a re-architecting of the column specification method for BrowseEdit, Version 4 adds multiple table select statements with updates on all tables. There are some additional features such as a checkbox that stores data in integer format, and 'alt' text for mouse hover on column titles.  Please read this document thoroughly and the notes in the class and examples.  While the class is backwards compatible in most respects with version 2, it is very important that you convert scripts to the new methodology. Future updates will not include the deprecated functions and these functions are not supported. Please read the section on class constructor, and set_columnType, as they are the heart of this class. All example scripts have been updated with the Version 3-4 methods. Please review them. They serve as a useful manual and are amply documented.

VERY IMPORTANT: THE ADDITION OF THE MULTIPLE TABLE SELECT HAS FORCED THE CALL OF THE UPDATE() and DELETE() FUNCTION TO FOLLOW SETTING COLUMN ATTRIBUTES. PLEASE ADJUST YOUR SCRIPTS ACCORDINGLY. SPECIFICALLY set_columnType($array) MUST PRECEDE UPDATE() or DELETE().

Please note that the example database has been expanded to include additional data, so please download and update.

The multiple table features allow any select statement that is updateable including inner joins, left and right joins, etc. Each table can be updated independently. Single table select statements will work identically as before. It is absolutely necessary to include 'table' for each field (table.field) and include each uid field for each table in multiple table sselect statements. Single table sql statements are not affected. You can hide the UID fields with the set_columnType function. The table and field used in instantiating the class will dictate the action of the 'select' column, and the order of table updates. For example, if deleteRecord() is called, the row in the table that is noted in the instantiation statement will be deleted, but not rows in the corresponding joined tables. Please read set_columnType PRIMARYKEY and set_multiDelimiter. -- New column type 'checkboxi' has been added. It stores on/off data as 1 and 0 instead of "on" and "" as 'checkbox' does. This adds some compatability with database features and TRUE FALSE statements.

-- Mouse hover text tags have been added with the 'alt' key in set_columnType, so that the user can place the mouse over a column header and get additional information.

-- Column header sorting capability is now on by default. The set_sortOrder function will override the default sort and any user selected sort. This is not backwards compatible. There is a new function to set the initial sort only: set_initialSort.


Version 3 added a dynamic value selectBox, a user-defined function, column display sequencing, among others.   The “selectForm” option has been deleted, and a readonly form should be used in its place.  The expansion of utilizing row data within action, selecting, and validating is available.   Any MySQL row data and be inserted into a valid action string by enclosing the field name with “#” symbols.  For example, an action column hyperlink:

$action=“<INPUT type=’button’ onClick=\”location=’test.php?email=#email#&contact_id=#contact_id#’\””;

The function column allows the programmer to define a function in the calling script and place the results of the function in the table.  This is a very useful feature and allows almost unlimited data manipulation.   Row data is sent to the function in a comma-separated array.  See notes below and in the class and example 8. 

The dynamic value selectBox feature allows the use of other table data and/or re-query of the main table to populate a drop-down list that changes for each row.   Unfortunately, this column is not editable, due to the inherent complexity. However,javascript action can be added through the validation function

Addition of script definable character codes for character sets other than Latin1 is available through new function set_charCode.


Version 2 added features to include column types for date and datetime,textarea, radiobutton select of row with javascript insertion, action column for buttons, links andjavascript. Graphics added to show the sort order direction (available as http://www.thinktrain.com/browse_edit/arrow_plain_up.gif and http://www.thinktrain.com/browse_edit/arrow_plain_down.gif .  New functions are highlighted in this document.

The following features are included:

Included files: ALL NEW FOR VERSION 4 - if you are new to BrowseEdit, examine each example file in the order shown