<?php foreach ($explode as $id) { $abcselect = mysql_query("SELECT * FROM `pzd` WHERE `id`='$id'"); $row = mysql_fetch_array($abcselect); } ?>