我在数据库中有两个与名称和地址匹配的信息。而不是返回2,此代码返回21.请参阅下文; (表)-employees ID 名称 地址
$select = mysql_query("
SELECT *
FROM employees
WHERE name LIKE '%John%'
OR name LIKE '%Johanson%'
AND address='Streetford End'
");
$count = mysql_num_rows($select);
echo $count
答案 0 :(得分:0)
这可能会有所帮助:
SELECT * FROM employees WHERE (name LIKE '%John%' OR name LIKE '%Johanson%')
AND address='Streetford End'