Код: Выделить всё
$options = array(); //here's your choices
$options[] = 'blablabla';
$options[] = 'blabla';
foreach($options as $key => $value)
{
echo '[*]' . $value . '';
}
$sql_unique = "SELECT Forums_ForumID, list
FROM (
SELECT Forums_ForumID, GROUP_CONCAT( Topics_TopicID ) AS list
FROM (
SELECT *
FROM Topics_crosstable
ORDER BY Topics_TopicID
)H
GROUP BY Forums_ForumID
)A
WHERE list = (
SELECT GROUP_concat( TopicID )
FROM Topics
WHERE Name IN (";
$sql_unique .= implode(",",$options);
$sql_unique .= ") ORDER BY Forums_ForumID ASC )";
$result = mysql_query($sql_unique);
//print "$result";
//echo $result;
//echo mysql_num_rows($result);
//$assoc = mysql_fetch_assoc($result);
var_dump($result);
Подробнее здесь: https://stackoverflow.com/questions/156 ... e-in-query
Мобильная версия