#42004 [NEW]: Using Update...SET table.field = CASE...;works in console, but not from php
| From: | ramesh at val dot is | Date: | Mon, 16 Jul 2007 09:36:05 +0000 |
| Subject: | #42004 [NEW]: Using Update...SET table.field = CASE...;works in console, but not from php | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-115103@lists.php.net to get a copy of this message | ||
From: ramesh at val dot is
Operating system: Linux & Winows Server 2003
PHP version: 4.4.7
PHP Bug Type: MySQL related
Bug description: Using Update...SET table.field = CASE...;works in console, but not from php
Description:
------------
Running UPDATE...SET...CASE query in console works, but not from php code
-> sets to NULL;
Reproduce code:
---------------
UPDATE...
SET...
products.products_price = @nPrice:= (CASE LENGTH(ROUND(@price:=
@finalprice * @tax:= ((tax_rates.tax_rate/100)+1)))
WHEN 10 THEN INSERT(ROUND(@price),8,3,'900')/@tax
WHEN 9 THEN INSERT(ROUND(@price),7,3,'900')/@tax
WHEN 8 THEN INSERT(ROUND(@price),6,3,'900')/@tax
WHEN 7 THEN INSERT(ROUND(@price),5,3,'900')/@tax
WHEN 6 THEN INSERT(ROUND(@price),4,3,'900')/@tax
WHEN 5 THEN INSERT(ROUND(@price),3,3,'900')/@tax
WHEN 4 THEN INSERT(ROUND(@price),3,2,'99')/@tax
WHEN 3 THEN INSERT(ROUND(@price),2,2,'99')/@tax
WHEN 2 THEN INSERT(ROUND(@price),2,1,'9')/@tax
WHEN 1 THEN ROUND(@price)/@tax ELSE @price END)
* 1,
products.products_price = @nPrice,
Expected result:
----------------
From console; the code works, @nPrice is inserted successfully.
From php code; only the CASE statement is not processed!
There is no MySQL errors.
Actual result:
--------------
@nPrice is set to NULL.
--
Edit bug report at http://bugs.php.net/?id=42004&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42004&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42004&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42004&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42004&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42004&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42004&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42004&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42004&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42004&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42004&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42004&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42004&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42004&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42004&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42004&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42004&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42004&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42004&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42004&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42004&r=mysqlcfg