php.net |  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
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: shhbrk at diku dot dk
New email:
PHP Version: OS:

 

 [2004-11-24 17:09 UTC] shhbrk at diku dot dk
Description:
------------
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.



Patches

Pull Requests

History

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

Please read MySQL Documentation at http://dev.mysql.com/doc/mysql/en/index.html ... 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] georg@php.net
Please reread http://bugs.php.net/how-to-report.php. 
 
No information available about 
- the MySQL Version  
- the PHP Version 
- the table definition 
 
- No reproducable testcase 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC