Creating PHP Code

From nuBuilderPro
Jump to: navigation, search

PHP Code can be used in a number of places within nuBuilder.

PHP Code created in this section can be used by running a javascript function called nuRunPHP() and passing the Code of this PHP record as a parameter eg. nuRunPHP('001');

PHP Code can also be run directly from the Run PHP Code Button under the Setup Tab.

Php code 2.PNG

Fig 1. PHP Page


Running the PHP code from the Run PHP form will open a new Window where any results can be displayed using PHP's print or echo functions


PHP Code created on the PHP Code form can also be used to build the temporary table used by nuBuilder Reports when running a Report.


The Fields required for creating one of these records are..

Code

Used to help find the appropriate record.

Description

Used to describe and help find the appropriate record.

Group

Used to help find the appropriate record.

Criteria Form

This form is to generate values for the parameters for the PHP code as required only if being run directly off the Run PHP Code Button. Otherwise any Hash variable values can be taken directly off the Edit Form calling nuRunPHP()

Allow Non Secure Access

Whether this Procedure can be run at the server's command line via a cron jobs etc. (eg. nucall.php?c=006 ).

Show in List

If set to No, this Procedure will not be visible to Users (other than globeadmin), from the list of runnable Procedures. (rph - Run Procedures) Form.

PHP

The PHP code that is to be executed when javascript nuRunPHP() is run or within an iFrame Object.

e.g

//print all basic information about customer
$sql = "SELECT * FROM customer WHERE customer_id = '#inv_customer_id#'";
$qry = nuRunQuery($sql);
$obj = db_fetch_object($qry);

print " customer name: $obj->cus_name
customer phone: $obj->cus_phone
customer email: $obj->cus_email";

Invoking the syntax checking editor