|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30883 MySQL query bug
Submitted: 2004-11-24 17:09 UTC Modified: 2004-11-25 17:55 UTC
From: shhbrk at diku dot dk Assigned:
Status: Not a bug Package: MySQL related
PHP Version: Irrelevant OS: WIN98
Private report: No CVE-ID: None
 [2004-11-24 17:09 UTC] shhbrk at diku dot dk
Hello all

I'm expiriencing a bug when trying to perform something like this MySQL query from PHP:

Select *, @d := x^2
from o
where cos(@d)+sin(@d)>0;

this is a short version of my real query, but shows the deal. (x is a key in o and the important part is the repeated use of @d, this is what I want since it is a more complex calculation in "real life".)

When I test it from the prompt in MySQL it works just fine and gives the results as expected.
But from a PHP script it returns 0 rows...!
I'm certain that something is wrong because when I use a version that looks like this: WHERE cos(x^2)+sin(x^2)>0
 - that is @d substituted in place - it work just fine.

Can anyone explain this ?

Thanks in advance.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-25 11:36 UTC]
This is not a PHP bug.

Please read MySQL Documentation at ... in special documentation related to user variables.
 [2004-11-25 16:05 UTC] shhbrk at diku dot dk
I'm sorry but the documentation (9.3 User Variables) isn't helping me - it doesn't explain why the query works from the MySQL-prompt and not through PHP...
 [2004-11-25 17:55 UTC]
Please reread 
No information available about 
- the MySQL Version  
- the PHP Version 
- the table definition 
- No reproducable testcase 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 28 21:03:37 2023 UTC