There is such a request:

SELECT `inpoint` FROM `u_prof` WHERE `inpoint`!='' AND `inpoint` NOT IN ('".implode(",", $usedInpoints)."') GROUP BY `inpoint` 

Those. The $usedInpoints array is $usedInpoints and compared with it And how can you alter the request so that there is not a strict comparison, but through LIKE, like:

 NOT LIKE IN ('%".implode(",", $usedInpoints)."%') 
  • What type of inpoint field in the u_prof table and what are the elements of the array `$ usedInpoints` - chernomyrdin
  • inpoint - varchar, array elements - character sets - DemoS

1 answer 1

Judging by the expressions SQL expression prednazanachatsya for PHP, then you can:

 $where = array("`inpoint`!=''"); foreach ($usedInpoints as $_) { $where[] = "`inpoint` NOT LIKE '%$_%'"; } $sql = "SELECT `inpoint` FROM `u_prof` WHERE " . implode(" AND ", $where) . "GROUP BY `inpoint`"; 
  • What you need, Thank you! I just thought you could do something like one. - DemoS