Search using WHERE, AND, LIKE, OR Query Functions
- Looking for an exact match in field1:
SELECT * FROM table WHERE field1 = '$name'
- Looking if the field1 contains the search word anywhere using LIKE and both
'%%'
SELECT * FROM table WHERE field1 LIKE '%$word%'
- Looking if the field1 contains the value that begins with our word using LIKE
and the last ' %'
SELECT * FROM table WHERE field1 LIKE '$word%'
- Looking if the field1 contains the value that ends with our word using LIKE
and the first '% '
SELECT * FROM table WHERE field1 LIKE '%$word'
- Looking if our search word appears in both fields using AND
SELECT * FROM table WHERE field1 LIKE '%$word%' AND field2
LIKE '%$word%'
- Looking if our search word appears in any of the two fields using OR
SELECT * FROM table WHERE field1 LIKE '%$word%' OR field2
LIKE '%$word%'
- Looking if our word is in field1 OR in field2 AND field3 using Parentheses
SELECT * FROM table WHERE field1 LIKE '%$word%' OR (field2
LIKE '%$word%' AND field2 LIKE '%$word%') ORDER BY id DESC
NewSourceMedia is providing links to these listings as
a courtesy, and makes no representations regarding the content or
any information related thereto. Any questions, complaints or claims
regarding the downloaded content or details must be directed to the appropriate
publisher. We do not encourage or condone the use of any
software in violation of applicable laws.