1
I need to make a query where only display results in one condition:
# Search the Database
$select_sql = "SELECT * FROM users WHERE user LIKE :search OR date_access LIKE :search OR ip LIKE :search AND active LIKE :active ORDER BY id DESC";
$select_db = $connect->prepare($select_sql);
$select_db->bindValue(':search', "%{$search_user}%");
$select_db->bindValue(':active', "yes");
$select_db->execute();
However the way above did not work, it normally displays the data as the survey but also displays the data that is not of the same parameter (users that are not active).
Play a parentheses after the
WHERE
and close it before theAND
, see if it is the desired result.– rray