Probeer alle records in slechts één zoekopdracht te selecteren, als volgt:
$text = '12-name-y-86';
$array = explode('-', $text);
$array = "'" . implode(',', $array) . "'";
$sql = mysql_query("SELECT * FROM `table` WHERE `pid` IN (' . $array . ') ORDER BY `id` LIMIT 3");
while($row = mysql_fetch_array($sql)) {
echo $row['title'];
echo '<br />';
}
echo '<br /><br />';