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



I'll check that out. Thanks Michael!


On Wed, Feb 6, 2013 at 3:26 PM, Michael Schutte <mschutte369@xxxxxxxxx>wrote:

That's how we do it when using a prepared statement.

I'm kinda new to the PHP world so I wouldn't be much of an expert on it.

Anyway, if you received an associative error, I would imagine it's because
of a difference in the name being returned. Maybe try using all CAPS. in
both the SELECT and the $Row['ERROR']


On Wed, Feb 6, 2013 at 1:46 PM, Michael Ryan <michaelrtr@xxxxxxxxx> wrote:

That worked Michael...thank you! I'm getting an index error in $WkError =
$row["Error"], but that's probably because I'm using a different
associative name, right? I should be able to figure that out.

Is it better to use the array on the db2_execute rather than
db2_bind_params?

Thanks for the help!


On Wed, Feb 6, 2013 at 1:20 PM, Michael Schutte <mschutte369@xxxxxxxxx
wrote:

Michael,

Put your parameters into an array.
db2_execute's second parm accepts parms and will replace the question
marks
in order.

$query = "SELECT NEWSYS.MSP_ValidateStoreFN(cast (? as char (3) ) ) AS
Error FROM SYSIBM.SYSDUMMY1";
$parms = array($Wk_Store);
if (!($stmt = db2_prepare($conn, $query)))
{
echo "Query Statement: " . $query . "<br />";
die("Error preparing statement: " . db2_stmt_errormsg() . " (" .
db2_stmt_error() . ")");
}
// Execute the statement.
if (!(db2_execute($stmt, $parms)))
{
db2_close($conn);
echo "Query Statement: " . $query . "<br />";
echo "Parameter Values:<br />";
foreach($parms as $parm)
{
echo $parm . "<br />";
}
die("Error executing statement: " . db2_stmt_errormsg() . " (" .
db2_stmt_error() . ")");
}
$WkError = "";
if ($row = db2_fetch_assoc($stmt))
{
$WkError = $row["Error"];
}


On Wed, Feb 6, 2013 at 1:10 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:


On Wed, 6 Feb 2013, at 12:42 PM, Michael Ryan <michaelrtr@xxxxxxxxx>
wrote:

Still on my 'figure out how to call an SQL UDF from PHP' trail of
tears..

What is the DB2 error state etc. after the prepare and bind steps
Michael?
That might provide a better idea of what is going on. Can't see
anything
glaringly obvious.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



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.