<> (NOT) 运算符有问题。
我正在尝试检索 habbo_name 不等于给定两个的行,但它仍在返回这些行。有没有人对我如何解决这个问题有任何建议?
代码:
<?php
$query = "SELECT `user_id`, `rank`, `habbo_name`, `rating`, `branch` FROM `personnel` WHERE status='active' AND `rating` LIKE '%(SDP%' OR `rating` LIKE '%/SDP)%' AND (`habbo_name` <> '-Jose,' AND `habbo_name` <> 'tharuka$') AND status='active' ORDER BY `habbo_name`";
$result = $con->prepare($query);
$result->execute();
while($row = $result->fetch()) {
echo "<b>SDP:</b> " . htmlspecialchars($row['habbo_name']) . "<br>";
}
?>
结果:
SDP: -Jose,
SDP: -Wyatt-
SDP: CPT.Black
SDP: Dr.Jacobson
SDP: Malwarebyte
SDP: NShadow
SDP: tharuka$ (Dudestetson)