SELECT * FROM dbase where type=substr("type=1",5);//这句查不到结果
SELECT * FROM dbase where type=1;//这句能查出正确结果
type在表dbase中是int类型
在mysql中好像是可以char和int比较的啊?
“type=1”为上一页面传递参数切割后的字符串$ids
echo substr($ids,5)显示也为1;
但SELECT * FROM dbase where type=substr($ids,5);的执行结果却是空,没有把数据库中type=1的显示出来
又用
SELECT * FROM dbase where type=convert(substr("type=1",5),int);
SELECT * FROM dbase where type=cost(substr("type=1",5) AS int);
都是错误的,怎么回事呢,怎么处理呢?
谢谢各位,过渡一下凑合解决了
$a=substr($ids,5);
SELECT * FROM dbase where type=$a;