There are 3 basic ways to access D3
See the full list of object oriented commands.
01 SUBROUTINE FLAVORS.SUB(FDLIST, ROOTLIST, FORM, ENV, REPLY) 02 INCLUDE HDR.INCLUDE 03 FLAVORS = "CHERRY1":VM:"CHERRY2":VM:"CHERRY3" 04 FLAVORS<-1> = "BANANA" 05 FLAVORS<-1> = "GRAPE" 06 FLAVORS<-1> = "LEMON" 07 CALL FILLARRAY(FLAVORS,REPLY) 08 RETURNThe above program would return this PHP array:
Array ( [0] => Array ( [0] => CHERRY1 [1] => CHERRY2 [2] => CHERRY3 ) [1] => BANANA [2] => GRAPE [3] => LEMON )Here's the PHP code that generated the above output:
require "./d3class.php"; $d3 = new d3("localhost", 9001, 9009); $flavors = $d3->fill_array("FLAVORS.SUB", $_GET); print_r($flavors);
01 SUBROUTINE READ_USER.SUB(FDLIST, ROOTLIST, FORM, ENV, REPLY) 02 ******************************* 03 * Read the webuser record * 04 * Return named array elements * 07 ******************************* 08 INCLUDE HDR.INCLUDE 09 USERID = "" 10 REC = "" 11 USER = "" 12 FCOUNT = DCOUNT(FORM,AM) 13 FOR I = 1 TO FCOUNT 14 IF FORM<I,1> = "userid" THEN 15 USERID = FORM<I,2>; 16 END 17 NEXT I 18 IF USERID NE "" THEN 19 READ REC FROM FDLIST(USER.FILE),USERID ELSE REC = "" 20 END 21 * 22 USER<-1> = "userlogin":VM:USERID 23 USER<-1> = "password":VM:REC<1> 24 USER<-1> = "securitylevel":VM:REC<2> 25 USER<-1> = "email":VM:REC<4> 26 USER<-1> = "lockout":VM:REC<5> 27 USER<-1> = "firstname":VM:REC<6> 28 USER<-1> = "lastname":VM:REC<7> 29 USER<-1> = "title":VM:REC<8> 30 CALL FILLKEYEDARRAY(USER,REPLY) 31 RETURN
The above program would return this PHP array:
Array ( [userlogin] => bjones [password] => fyi453 [securitylevel] => 5 [email] => bjones@jones.com [lockout] => N [firstname] => Bob [lastname] => Jones [title] => Sales Manager )
$arr = array(); $arr['name'] = "Bob Jones"; $arr['address1'] = "101 Main St."; $arr['city'] = "San Francisco"; $arr['state'] = "CA"; $arr['zip'] = "94115"; $d3->set_all_fields($arr); $d3->merge_data("user.txt");