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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ramesh at val dot is
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Oct 12 00:01:40 2024 UTC