在mysql中,每个命令之间都要留一点空格
如果是这样,
$query = "select * from books where " .$searchtype. "like'%" .$searchterm. "%'";
那么print_r(),就会输出:select * from books where titlelike'%java%',
like 和那些都在一起了,命令有错,
应该是这样:
$query = "select * from books where " .$searchtype. " like '%" .$searchterm. "%'";
print_()输出:select * from books where title like '%java%'1
,成功。。
在like两边都要有空格。。