Create MYSQL like or from php query string

I am trying to take a get variable and perform a database search from it but really struggling on how to approach it.

$_GET['words']            &words=BH15,BH17,BH14,BH18,BH12,BH16,BH13

$sql  = "SELECT * FROM table WHERE reference='".$ref."' AND table.postcode LIKE '%{$words}%' ORDER BY status ASC, RAND()";

Words needs to be split as an array and then perform the LIKE search

you need a separate LIKE for each word.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.