I am trying to run a FOREACH with PDO but so far my code seems to iterate only once for the FOREACH and returns only the 1st value.
Here is what I have:
$colors = $_GET['color'];
$colors = explode(' ', $colors);
foreach ($colors as $color)
{
$items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1");
$items -> bindValue(":colorbase1", $color);
}
$items ->execute();
while($info = $items->fetch(PDO::FETCH_ASSOC))
{
echo $info['color_base1'];
}
Note that $colors contains more than 1 different color obtained from checkboxes and a jquery.
Thanks!