1

TABLE TOOL

(id,toolname)

1, Mini flathead screwdriver

TABLE KEYWORDS

(id,title,toolid)

1, Mini, 1
2, flathead, 1
3, screwdriver, 1
$svar1=$_GET[svar];
$svar=strtolower($svar1);
$sv="%$svar%";

$query=$con->prepare("SELECT t.toolname 
                      FROM tools t 
                        INNER JOIN keywords k ON t.id=k.toolid 
                      WHERE k.title LIKE ? 
                      GROUP BY t.id")
$query->execute([$sv]);

Now it works if user enters one word, but Is there a way to combine the keywords so that if user searches "mini screwdriver" or any combo of the accepted keywords it works?

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
craison
  • 45
  • 3

0 Answers0