在mysql客户端中,使用此条件的查询工作正常,但是当将此查询放在php页面中时,无法正常工作:
变量是$ _REQUEST:
SELECT * FROM table_name
WHERE 1=1
AND idbook = '$idbook'
AND book_year between coalesce('$year',book_year ) and coalesce('$year',book_year )
如果删除此行AND book_year between coalesce('$year',book_year ) and coalesce('$year',book_year )
,查询工作正常。
如何解决?