#42004 [Opn->Fbk]: Using Update...SET table.field = CASE...;works in console, but not from php

From: Date: Sat, 21 Jul 2007 00:32:15 +0000
Subject: #42004 [Opn->Fbk]: Using Update...SET table.field = CASE...;works in console, but not from php
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115266@lists.php.net to get a copy of this message
ID: 42004 Updated by: jani@php.net Reported By: ramesh at val dot is -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: Linux & Winows Server 2003 PHP Version: 4.4.7 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi Previous Comments: ------------------------------------------------------------------------ [2007-07-16 09:36:05] ramesh at val dot is 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 this bug report at http://bugs.php.net/?id=42004&edit=1

« previous php.bugs (#115266) next »