×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




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 ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.