I think the problem may be with your $sQry value. Looks like you need to do one of the following:

1) Change the initial qualifier to a double quote.
$sQry = "SELECT ID FROM FINAL TABLE( INSERT INTO MyLibrary.zTest ( METHOD, AGENT, IP ) VALUES ( 'GET', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0', '76.187.52.97' ) ) ;" ;

2) Put the \ in front of each internal single quote to ignore that quote.
$sQry = 'SELECT ID FROM FINAL TABLE( INSERT INTO MyLibrary.zTest ( METHOD, AGENT, IP ) VALUES ( \'GET\', \'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0\', \'76.187.52.97\' ) ) ;' ;

If that is what I'm thinking, what it is doing is getting to the single quote before 'GET and is expecting that to be the end of your statement.

-JA-

Jason Aleski / IT Specialist

On 12/4/2015 10:34 AM, Rob wrote:
This is the code...

if ( $oDB = db2_pconnect( '', '', '', array( 'i5_naming' => DB2_I5_NAMING_OFF ) ) )
{
// Save Data And Retrieve Auto Incremented ID
$sQry = 'SELECT ID FROM FINAL TABLE( INSERT INTO MyLibrary.zTest ( METHOD, AGENT, IP ) VALUES ( 'GET', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0', '76.187.52.97' ) ) ;' ;

$sRes = db2_exec( $oDB, $sQry ) ;
db2_close( $oDB ) ;
}

All I get in the error log is:

[04-Dec-2015 11:26:24 EST] PHP Warning: db2_exec(): Statement Execute Failed in /Test.php on line 51


In SiN:

[Fri Dec 04 16:05:26 GMT 2015 ] Run All

> SELECT ID FROM FINAL TABLE( INSERT INTO MyLibrary.zTest ( Method, Agent, IP ) VALUES ( 'GET', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0', '76.187.52.97' ) )

Statement ran successfully (141 ms)

The table was created from:

CREATE TABLE MyLibrary.zTest (
ID bigint GENERATED ALWAYS AS IDENTITY ( START WITH 1, INCREMENT BY 1, NO CYCLE ),
When timestamp WITH DEFAULT CURRENT TIMESTAMP,
Method varchar(4),
Agent varchar(255),
IP varchar(15),
Request xml,
PRIMARY KEY ( ID )
) ;

I am ready for my beating....

Thanks,
rob

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.