Informix PHP Prepare fails
Posted in 2003
Topics: Error Codes & Troubleshooting, Server Administration
I have the following code in my PHP file:
$sqlStmt = "select a.item_num".
" from agree_l a, item b".
" where a.agreement_code = '". $g_customer
['agreement_code']."'".
" and a.request_item = '".$item_num."'".
" and b.item_num = a.item_num;";
echo "$sqlStmt<BR>";
$rid = ifx_query ($selStmt, $db_conn);
When it gets to the ifx_query() statement it comes up with the following
error:
Warning: ifx_query(): Prepare fails (E [SQLSTATE=42 000 SQLCODE=-
201]) in C:\\webroot\\PHPinclude\\item_funcs.inc on line 35
The statement printed to the screen by the echo is:
select a.item_num from agree_l a, item b where a.agreement_code ='UNV' and a.request_item = '3333' and b.item_num = a.item_num;
When I take the query and place it into dbaccess it runs fine.
Why does this fail with ifx_query()?
Thanks for your help,
David
Well, if I looked closer at this, I would of noticed that I was setting
$sqlStmt but using $selStmt in the ifx_query() statment.
Need to retake the "Copy/Paste 101" class.
D Sandmann <CrackerDog22@yahoo.com> wrote in
news:Xns9421A510271D9dsandcrack@216.168.3.44:
> I have the following code in my PHP file:
> $sqlStmt = "select a.item_num".
> " from agree_l a, item b".
> " where a.agreement_code = '". $g_customer
> ['agreement_code']."'".
> " and a.request_item = '".$item_num."'".
> " and b.item_num = a.item_num;";
> echo "$sqlStmt<BR>";
> $rid = ifx_query ($selStmt, $db_conn);
>
> When it gets to the ifx_query() statement it comes up with the
> following error:
> Warning: ifx_query(): Prepare fails (E [SQLSTATE=42 000
> SQLCODE=-
> 201]) in C:\\webroot\\PHPinclude\\item_funcs.inc on line 35
>
> The statement printed to the screen by the echo is:
> select a.item_num from agree_l a, item b where
> a.agreement_code => 'UNV' and a.request_item = '3333' and b.item_num = a.item_num;
>
> When I take the query and place it into dbaccess it runs fine.
>
> Why does this fail with ifx_query()?
>
> Thanks for your help,
> David
>