这个查询是我的返回治疗师的'therapistTable.activated'等于false以及那些设置为true!所以它基本上是选择所有的分贝,任何意见将不胜感激!mySQL查询不会返回正确的结果!
` $query = "SELECT therapistTable.* FROM therapistTable WHERE therapistTable.activated = 'true' ORDER BY therapistTable.distance "; `
这个查询是我的返回治疗师的'therapistTable.activated'等于false以及那些设置为true!所以它基本上是选择所有的分贝,任何意见将不胜感激!mySQL查询不会返回正确的结果!
` $query = "SELECT therapistTable.* FROM therapistTable WHERE therapistTable.activated = 'true' ORDER BY therapistTable.distance "; `
列activated
的列类型是什么,以及表中的一些示例值是什么?
它可能是BOOL或其他整数值吗? 'true'是一个字符串 - TRUE是一个整数。
如果therapistTable.activated是一个BOOL,您将要比较它为TRUE而不是一个字符串。
它实际上是一个带有字符串的varchar,但我会将其更改为布尔值并尝试使用 – 2010-03-19 23:37:19
哦,嘿,不要随心所欲地做这件事 - 存储字符串值没有任何问题。 表中的一些示例值是什么? – TehShrike 2010-03-19 23:43:23
k它没有工作,我把它变回varchar我使用navicat设置therapistTable.activated值为真或假没有引号或任何东西只是, – 2010-03-19 23:51:05
如果您使用的是布尔类型,你应该使用TRUE
而不是'true'
。我不知道怎么会导致你的问题虽然..
只是为了解释:TRUE
是一个整数(等于1),但'true'
是一个字符串。
$query = "SELECT therapistTable.* FROM therapistTable WHERE therapistTable.activated = 'true' ORDER BY therapistTable.distance ";
是正确的
皮特:你的问题,请提供以下'SHOW的输出CREATE TABLE therapistTable' – hobodave 2010-03-19 23:36:35
我很抱歉,但那里有一些敏感的信息在它 – 2010-03-19 23:53:59
秀创建表,不会显示任何数据。 – DarthVader 2010-03-20 00:08:55