select * from vote where '$ip' in (select ip from vote where news_id='$id')
这是子查询要在4.0以上才支持select * from vote where ip='$ip' and news_id=$id;
你试这句看看。
这是子查询要在4.0以上才支持select * from vote where ip='$ip' and news_id=$id;
你试这句看看。
你的第二条sql语句中“and”和前面的‘ip’距离太近了,要加上空格!
否则是无法执行的!
看楼上老大的吧
2:'$ip'and 需要空格。select * from vote where ip='$ip' and news_id='$id'
这种语法风格俺比较赞成,严谨点好。
至于能不能达到楼主的目标俺不知道