i need some code for search some data inside DB…
i have two fields that is id and name…
if i type “ABC” it can show all data about “ABC”..
if “DEF”=>all DEF data…or i type anything it can show that “anything”…
i’m just know how to show all data inside fields that makes “ABC” and “DEF” show together,the code like this:
"SELECT ID,Name FROM Regist ORDER BY date";
MySQL wildcards:
_AND%(in conjunction with keywordLIKE)_denotes a single characterOutput: ‘grAy’, ‘grEy’.
%denotes any number of charactersOutput: ‘grAY’, ‘grEY’, ‘grEEN’.
You can use both
_and%multiple timesOutput: ‘GraY’, ‘OraNGE’.
In your case, if you want to list the names containing starting with either ‘ABC’ or ‘DEF’, your query would be like this:
If you want your names to contain the strings ‘ABC’ OR ‘DEF’ anywhere inside, your query would be:
Finally, if you want your names to contain both ‘ABC’ AND ‘DEF’ you could use: