Search code examples
phpmysqlimplode

multi select to mysql where


I have a multi-select box going to a PHP page which I am trying to take the selected values and place in a where statement. I can get the values back as 1 2 3 4 without the comma in-between. I have tried the implode and explode function with no luck.

foreach ($_POST['station'] as $stations)
echo  $station =  $stations."\n";

Solution

  • Try this

    $stations_string = implode(" OR ", $_POST['station']);