Print

PHP Functions


nuRunQuery()


Running nuRunQuery with a zero length string parameter eg $db = nuRunQuery(''), will return an array of the following

$db[0]=$DBHost;
$db[1]=$DBName;
$db[2]=$DBUserID;
$db[3]=$DBPassWord;

Running nuRunQuery() with a second parameter of false will cause the PHP code to ingnore any SQL statement that is not able to run or is invalid.

eg.

nuRunQuery("ALTER TABLE `table1` DROP PRIMARY KEY",false);


(if table1 has no Primary Key, the PHP code will continue to run ignoring this statement)


Running nuRunQuery with an SQL statement string, returns nothing for a DROP, INSERT, DELETE etc but for a SELECT returns a value that can be used by..

db_fetch_row()

Same as Mysql_fetch_row()

eg.

$table = nuRunQuery("SELECT * FROM customer");
 
while($row = db_fetch_row($table){
 
   print $row[1];
 
}

db_fetch_object()

Same as Mysql_fetch_object()

eg.

$table = nuRunQuery("SELECT * FROM customer");
 
while($array = db_fetch_array($table){
 
   print $array['cus_name'];
 
}

db_fetch_array()

Same as Mysql_fetch_array()

eg.

$table = nuRunQuery("SELECT * FROM customer");
 
while($object = db_fetch_object($table){
 
   print $object->cus_name;
 
}

tableFieldNames()

Puts all fieldnames from a select statement into a array.

nuDebug($pString)

Writes the string to zzsys_trap in the database.

nuSubformArray($pSubformName, $pJustUnticked)


Creates an array of the prefixes used for each row of the subform.

If $pJustUnticked is left blank or false all rows will be added to the array.
If $pJustUnticked is set to true, only those rows ticked (not to be deleted) will be added to the array.

$ar     = nuSubformRowArray('FMinvoice_item');
for(var $i = 0 ; $i < count($ar) ; $i++){
   nuDebug($ar[$i]);
}


will return in a zzsys_trap..

FMinvoice_item0000
FMinvoice_item0001
FMinvoice_item0002
FMinvoice_item0003
FMinvoice_item0004
FMinvoice_item0005
FMinvoice_item0006
FMinvoice_item0007


addJSfunction()

Adds a string of Javascript code to the form being opened
(used only in Custom Code Run Before Browse, Custom Code Run Before Open and PHP Data Code)

reformatField()

reformatField($value,$format,$quotes = true)
Reformats the value of a field in nuBuilder into a string that can be inserted into sql,
The $format parameter corresponds to the format number chosen when creating a nuBuilder Text object.

eg..

0 = 10000
1 = 10000.0
2 = 10000.00
3 = 10000.000
4 = 10000.0000
5 = 10000.00000
6 = 13-Jan-2007
7 = 13-01-2007
8 = Jan-13-2007
9 = 01-13-2007
10 = 13-Jan-07
11 = 13-01-07
12 = Jan-13-07
13 = 01-13-07
14 = 10,000
15 = 10,000.0
16 = 10,000.00
17 = 10,000.000
18 = 10,000.0000
19 = 10,000.00000


print '#vFrom#  <br>';
$fd = reformatField('#vFrom#',10);
print "$fd  <br>";


produces..

20-Apr-2011
'2011-04-20'

nuSendEmail()

nuSendEmail($to, $replyto, $content, $html, $subject, $wordWrap, $filelist, $receip, $replytoname, $toname)
Found in emaillib.php, uses PHPMailer library to send email.
Information regarding the SMTP server is read from the zzsys_setup table

eg.

require_once("emaillib.php");
require_once("common.php");
nuSendEmail("user@domain.com", "system@nubuilder.com", "Body Text", true, "Subject", 120, array($filename => $filesource), false, "nuBuilder", "Users Name");





Created by: system. Last Modification: Monday 05 of November, 2012 08:35:09 CST by steven.