MySQLi WHERE LIKE multiple criteria

前端 未结 4 1974
暖寄归人
暖寄归人 2021-01-13 10:01

I have the following example table and attributes:

---------------------------
|  Name  |       Town     |
---------------------------
| Name 1 |      POOLE          


        
4条回答
  •  深忆病人
    2021-01-13 10:24

    As Marc B stated, using explode.

    getPlayerTown());
    
    foreach($array as $Town){
      $list = $list ."'%" .$Town ."%', ";
    }
    
    $SQL = "SELECT * FROM `table` WHERE `Town` LIKE ANY(" .$list .")";
    ?>
    

    Please go the smart route and normalize your data. This idea may work, but that doesn't mean it is the best choice.

提交回复
热议问题