× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Vern,

I have. It says that it's a "Conversion error on variable or parameter *N. SQLCODE=-302" I still have yet to solve it. I just find it odd that I can run it when it's not a prepared statement and it works find. Still digging into it, though.

--JA



On 10/31/2016 1:14 PM, Vernon Hamberg wrote:
Jason

The error codes are documented at IBM''s Knowledge Center - have you looked there? Or done a Google on it?

There might also be an SQLCODE - I don't know if php lets you retrieve that, but it should be in the job log, if there is one for this kind of thing.

HTH
Vern

On 10/31/2016 1:01 PM, Jason Aleski wrote:
Pete,

Thanks for the feedback. That's what I'm leaning towards, but it's just odd that I can run the query one way and it works; but not another.

--Todd
On 10/31/2016 12:58 PM, Pete Helgren wrote:
You may want to output the parameter value and see what it is. Something at the back of my head tells me it is a data type mismatch (string for numeric) but I can't rightly remember. PHP is an untyped language but that lack of type can come back to haunt you. I am not sure if this is one of those cases.....

Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
LinkedIn - www.linkedin.com/in/petehelgren
Twitter - Sys_i_Geek IBM_i_Geek

On 10/31/2016 11:50 AM, Jason Aleski wrote:
Attempting to perform a simple select using a PHP and db2_prepared statements. Running the query directly works fine (first part of code). When I run the db2_execute($stmt, $params), I get an error saying "Statement Execute Failed" with a SQL Error Code of 22023. Can anyone see what I'm doing wrong here?

PHP Code Below

<?php
$conn = db2_connect($database, $username, $password, $options);

$sql = "SELECT count(*) FROM CUSTOMERS WHERE acctnbr = ". $_REQUEST['accountNumber'];
$stmt = db2_exec($conn, $sql);
while ($row = db2_fetch_array($stmt)) {
print "$row[0]\n";
}
print "THIS WORKS <hr />";





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.