This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$options = array('i5_lib' => 'MYLIB' ,'i5_libl' => 'MYLIB', 'i5_naming' => DB2_I5_NAMING_ON,'autocommit' => DB2_AUTOCOMMIT_OFF, 'cursor' => DB2_SCROLLABLE); | |
$db2Connection = db2_connect('DBNAME','USER', 'PASSWORD', $options); | |
if (!$db2Connection) { echo "false - Connection failed.";exit(); } | |
$sql_query="SELECT ALBUM.* | |
FROM ALBUM | |
WHERE ID = ?"; | |
$sql_statement = db2_prepare($db2Connection, $sql_query); | |
if($sql_statement ===false) {echo 'Prepare Failed - Error: ' . db2_stmt_error() . "|".db2_stmt_errormsg() ;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//C:/xampp/htdocs/81/ | |
session_start(); | |
$_SESSION['site']=81; | |
var_dump($_SESSION); //array (size=1) 'site' => int 81 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!isset($_SESSION['myobj'])) | |
{ | |
$myobj = new MyObj($parm); | |
$myobj->createSomething(); | |
$_SESSION['myobj']=serialize($myobj); | |
} | |
$myobj = unserialize($_SESSION['myobj']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Create an Array type | |
CREATE TYPE phone_numbers_array_type AS VARCHAR(12) ARRAY[1000] | |
--Create a variable default_array of type phonenumberarray with a default array specified | |
CREATE OR REPLACE VARIABLE default_array phone_numbers_array_type DEFAULT ARRAY['416-413-9394', '416-413-7727', '416-413-6254']; | |
--Create a function using the array | |
CREATE OR REPLACE FUNCTION do_something_with_phone_numbers ( | |
my_phone_numbers phone_numbers_array_type DEFAULT default_array) | |
RETURNS INTEGER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* @var $myclass MyClass */ | |
$myclass = ServiceLocator::locate('MyClass'); | |
$myclass->//::TODO:: press control space to invoke intellisense when the cursor is after the arrow to see the intellisense work! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="myform"> | |
<input id="CustomerName" name="CustomerName" type="text" /> | |
<input id="Phone" name="Phone" type="text" /> | |
... | |
</form> | |
<script type="text/javascript"> | |
//Pull in all the data from the HTML form called myform | |
var postData = $("#myform").serializeObject(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE LIB.MYJSON ( | |
ID BIGINT, | |
DATA CLOB); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$post = new Post(); | |
$post->title = 'My first blog post!!'; | |
$post->author_id = 5; | |
$post->save(); | |
# save runs SQL to insert the row into the db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH xx (CST_NAME, CST_COL_CNT, CST_SCHEMA, CST_TABLE) AS | |
( | |
SELECT CONSTRAINT_NAME, CONSTRAINT_KEYS, CONSTRAINT_SCHEMA, TABLE_NAME FROM QSYS2.SYSCST A | |
WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' AND TABLE_NAME='MYTABLE' | |
) | |
SELECT CONSTRAINT_SCHEMA, TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME FROM QSYS2.SYSCSTCOL, xx where | |
xx.CST_SCHEMA = CONSTRAINT_SCHEMA AND | |
xx.CST_TABLE = TABLE_NAME AND | |
xx.CST_NAME = CONSTRAINT_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$os = php_uname("s"); | |
$phpversion = floatval(substr(phpversion (),0,3)); | |
if($phpversion<5.6) | |
{ | |
if($os=="OS400") | |
{ | |
$defaultcafile = "/QOpenSys/QIBM/ProdData/SC1/OpenSSL/openssl-0.9.7d/cert.pem"; | |
} | |
else if ($os=="Linux") |