开发者

mySQL query not returning correct results!

This query that I have is returning therapists whose 'therapistTable.activated' is equal to false as well as those set to true! so it's basically selecting all of the db, any advice would b开发者_如何学编程e appreciated!

`           $query = "SELECT
                 therapistTable.*
                 FROM
                 therapistTable
                 WHERE
                 therapistTable.activated = 'true'
                 ORDER BY 
                 therapistTable.distance
                 ";              
`


What is the column type of the column activated, and what are some sample values from the table?

Is it perhaps a BOOL, or some other integer value? 'true' is a string - TRUE is an integer.

If therapistTable.activated is a BOOL, you will want to compare it to TRUE instead of a string.


If you're using a boolean type, you should be using TRUE and not'true'. I don't know how that would cause your problem though..

Just to explain: TRUE is an integer (equal to 1), but 'true' is a string.


$query = "SELECT therapistTable.* FROM therapistTable WHERE therapistTable.activated = 'true' ORDER BY therapistTable.distance ";

is correct

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜