Re: Informix PHP Prepare fails
Posted in 2003
Hi:
Remove the semicolon ';' at the end of the statement.
BTW. To be ready to switch all my PHP code to another DBMS (i.e. DB2) I use
the ADODB abstraction layer http://php.weblogs.com/adodb . There are another
abstraction layers (PEAR, metadata, etc.) but adodb works excelent.
----- Original Message -----
From: "D Sandmann" <CrackerDog22@yahoo.com>
To: <informix-list@iiug.org>
Sent: Monday, October 27, 2003 3:11 PM
Subject: Informix PHP Prepare fails
> 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
sending to informix-list