phpLens
 home  products examples manual  faq support forum  contact news  login store

More Examples:   View Source:   Popup Hot Updates Demo

Free Download

This is a preview of the new features of phpLens available in March 2002. The two most new exciting features in phpLens 2.0 are editing multiple rows in a grid, and hot updates.
  • You can now edit multiple records then click on Save to update your database.
  • Hot updates of popup lists work when editing (change the Country and see the State and City popups update themselves) and when searching (click on the search button on the top right).
Live Demo below. Try changing things and see how phpLens hot updates work!

  PHPLens
E Srch
(E) (e)name (e)country (e)state (e)city
1John Lim
2Larry Hagman
3Tom Hanks
4Lazy Mary
5Queen Elizabeth
  PHPLens (Page 1)  
E Srch

Mutiple Row Editing in Grid

To enable multiple row editing within the grid, you can use the phpLens settings screen, or set:

$lens->multipleEdit = true;

Hot Updates with Popups

Note how the city and state popups dynamicly update when the country changes. This uses our hot update technology to query the database server dynamically from your web browser and update the city and state fields.

PhpLens 2.0 now supports hot updates using a new lookupLens feature. Have a look at the following property setting:

$lens->lookupLens = "STATE^#select distinct state from cities where country={country};"

observe that the select statement is prefixed with #. This means that all variables enclosed in { } are actually data fields when creating or editing records. So if the COUNTRY popup field is set to "USA" in the browser, then we populate the STATE field with the values generated by:

select distinct state from cities where country='USA'

If you have codes and text descriptions, you can change your sql so that codes are stored but the more descriptive text is displayed:

$lens->lookupLens =
    "STATE^#select distinct statecode,statename from cities "
    ."where country={country};"

We have integrated these lookups with Javascript so that hot updates work from the browser. IE 5-6, Netscape 4.77 and Mozilla 0.9.* are supported. When you change the COUNTRY popup in the browser, we create an invisible browser window and query the web server (the page phplens_remote.php) with an SQL statement and retrieve the data from the database. The source code to phplens_remote.php is available for your review in the phpLens 2 release.

To keep track of what database that phplens_remote.php needs to query, we need to set a second property:

$lens->phplensDatabase = 'testdb';

This 'testdb' is a one of the databases you defined in the file phplens/config/phplens.config.inc.php. Eg.

$PHPLENS_DATABASES = 
array(			//driver, server, userid, pwd, database
	'testdb' => array('mysql','localhost','root','','test')
);
email: contact#phplens.com (change # to @)     telephone (malaysia): 60-3-7947 2888     fax (malaysia): 60-3-7947 2800