[ic] SQL query error

Kevin Walsh interchange-users@icdevgroup.org
Tue Jul 16 23:55:01 2002


>
> I got the following error in my error.log when I attempted to run an
> sql query:
>
> ------------------------------------------------------------------------------------------
> trial /store/trial/ord/receipt.html Bad SQL statement: Parse error
> near <WPDISPLAY ITEM=cartId>
>      at /usr/local/interchange/lib/Vend/Scan.pm line 585.
>
> Query was: update transactions set wp_payment_status = 'Success'
> where code = <WPDISPLAY ITEM=cartId>
> ------------------------------------------------------------------------------------------
>
> This happened after making a payment to WorldPay, in my WorldPay
> callback script,
>
> where
> <WPDISPLAY ITEM=cartId>
> is the code of the transaction, returned by WorldPay, which got its
> value after my Checkout page.
>
> When I attempt to print <WPDISPLAY ITEM=cartId> out, its value is
> shown correctly on the html page, eg, 1234.
>
> I just wonder why when used inside the SQL query, that piece of
> WorldPay code doesn't get interpreted.  Any idea what the problem
> could be?  I'll be grateful for any pointers!
>
You need quotes round the &lt;WPDISPLAY ITEM=cartId> string, as
unquoted strings are expected to be integers.  The dump of the
original query in the error.log is supposed to help you spot that
sort of thing.

--
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/