Contents

 
Home
PHPRunner 6.1 manual
Prev Page Next Page
 
 

Update multiple records on the List page

 

To update multiple records on the List page at the same time you can create new button Update selected, then choose records on the List page and click the Update selected button.

yellowbulbNote: Change the values listed in red to match your specific needs.

1. Proceed to the Visual Editor page.

2. Create the custom button Update selected and add the following code

to the Server tab:

global $dal;

for ($i=0; $i<count($keys); $i++)

{

  // set ReportsTo field to 'Bob Smith'

  $sql = "Update employees set ReportsTo='Bob Smith' where KeyField="

    . $keys[$i]["KeyField"];

  CustomQuery($sql);

}

 

$result["txt"] = "Records were updated.";

and to the Client After tab:

var message = result["txt"];

ctrl.setMessage(message);

The Client Before tab should be blank (delete sample code there if any).

For more information about using Data Access Layer (DAL), see Data Access Layer.

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)