I’m working on a open source script. (https://github.com/keverw/Random-Quotes)
SELECT * FROM quotes WHERE text LIKE '%$searchTermbox%' AND OR author LIKE '%$searchTermbox%' LIMIT 15
I’m trying to make a simple search engine where it searches both text and author and also won’t have duplicates. Any ideas? So if i type in “Kevin” it would show both authors with that name and Quotes mentioning them.
So AND OR because somethings they both will mention it or they both won’t…. Any ideas how to write something very simple like this? I’m very basic at MySQL.
id | text | time | author | approved is the Structure. Also approved needs to = 1
You don’t need the
AND.This will select all quotes where either text or author or both contain
$searchTermbox.This is because when using
OR, theANDcase is covered as well. By default,a OR bmeansa, b or both.