I have code that dynamically searches for data in a database using ajax, but I can only search for one keyword at a time. I would like to change it so that I can search for a few keywords. Now, if I type 2 words, separated by a space and in the database, the data is not separated by a space, there will be no result. If the database contains data:
'playstation3' or 'play cool station3'
and I'm looking for:
play station
There were no results. I would like to know if the code can be changed so that I can search for two or more keywords or words separated by a space or another word, or DOT or underscore or (-) or (+) or (%), or (anything another lol).
I know that I should use pdo or mysqli, but I use this only for testing!
$queried = $_POST['query'];
$search = mysql_query("SELECT * FROM links WHERE name LIKE '%$queried%'");
while($searche = mysql_fetch_array($search)){
echo "".$searche['link']."</br>".$searche['name']."</br>".$searche['size']."</br>".$searche['category']."<hr></br></br>";
}
source
share