使用通配符,以便所有記錄匹配。如何在MySQL的instr()中應用通配符?
我的代碼:
if(empty($tag))
{
$tag="%";
}
mysql_query("select * from mytable where instr(tag,'$tag')>0") or die(mysql_error());
但它返回結果爲零。 即使
if(empty($tag))
{
$tag="*";
}
它仍然返回零結果。如何解決這個問題?