How to search multiple fields in a database
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 LIK


(25 votes, average: 4.00 out of 5)
what??? explain it carefully
SELECT * FROM table WHERE field1 LIKE ‘%$word%’
this query gives me an error, seems that is not write spelled
$cur = odbc_exec( $cnx, “SELECT * FROM test WHERE Name LIKE ‘%” . $_REQUEST['Name'] . “%’”);
cant understand thecode
This web must have more information,as the given data not clear the concepts
SELECT * FROM table WHERE field1 LIKE ‘%$word%’
this query gives me an error, seems that is not write spelled
view this link… http://7mliveonline.com/
anureet view this link http://7mliveonline.com/ it will be helpfull for u.
regards james
i m also going to check it kaleem. thanks in advance.
Ohana here is an excelent link which will be helpfull to u.
regars gery
waqas here is an excelent link for date diffrence which will be helpfull to u… http://7mliveonline.com/
regars gery