php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42004 Using Update...SET table.field = CASE...;works in console, but not from php
Submitted: 2007-07-16 09:36 UTC Modified: 2007-07-28 01:00 UTC
Votes:4
Avg. Score:3.2 ± 1.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ramesh at val dot is Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.4.7 OS: Linux & Winows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
11 - 7 = ?
Subscribe to this entry?

 
 [2007-07-16 09:36 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 22:01:27 2024 UTC