My code :
$text = \'12-name-y-86\';
$array = explode(\'-\',$text);
foreach($array as $value) {
$sql = mysql_query(\"SELECT * FROM `table` WHERE `pid`=\'$valu
Try to select all records in just one query, like this:
$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 '
';
}
echo '
';