Choose your database:
MS SQL Server
SQL Anywhere

Subscribe to our news:
Steven Langfield: "I wanted to drop you a mail to say how freaking AMAZING your software is. It will be the best £100 I have ever spent. I have still to read all your documentation to take full advantage but what you have created is truly amazing".
Grey: "We're a two-person company, it's just me an my wife. I'm the technical guru, and she handles the business operations. I have to know a lot about MySQL, but that's much too technical for her. I have frequently had to setup CGI scripts (I code in Perl) so she can manage some of our tables (suppliers, manufacturers, etc).

I discovered PHP Generator a couple of days ago, tried the free version,and within a few hours I had purchased the Pro version (as well as SQL Maestro for MySQL).

Today I am completing the conversion of the last of my custom table managers to PHP Generator. This is eliminating several thousand lines of code that I don't have to support any more!

Thanks for this fantastic product".


Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next


This event allows you to customize page-level permissions.



function OnGetCustomPagePermissions($pageName, $userId, $userName, $connection, &$permissions)




The name of the page


The id of the current user


The name of the current user


An instance of EngConnection class


Permissions to be applied to the page. An instance of the PermissionSet class.



This example shows how to implement a simple role-based permission model. Our goal is to ensure that only site admins and members of the Sales role can add, remove and edit records displayed on this page.


// do not apply these rules for site admins

if (!GetApplication()->HasAdminGrantForCurrentUser()) {    

    // retrieving all user roles 

    $sql =        

      "SELECT r.role_name " .

      "FROM phpgen_user_roles ur " .

      "INNER JOIN phpgen_roles r ON = ur.role_id " .

      "WHERE ur.user_id = %d";    

    $result = $connection->fetchAll(sprintf($sql, $userId));


    // iterating through retrieved roles

    if (!empty($result)) {

       foreach ($result as $row) {

           // is current user a member of the Sales role?

           if ($row['role_name'] === 'Sales') {

             // if yes, allow all actions.

             // otherwise default permissions for this page will be applied

             $permissions->setGrants(true, true, true, true);







See also: OnGetCustomRecordPermissions.

Prev Return to chapter overview Next