| кто подскажет так правельно не сильно ли напряжно ?
$result = $db->sql_query("(SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='1' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)
UNION (SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='2' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)
UNION (SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='3' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)
UNION (SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='4' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)
UNION (SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='5' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)
UNION (SELECT id, cid, title, UNIX_TIMESTAMP(time) as formatted, hometext, status, code, images FROM ".$prefix."_news WHERE cid='6' AND time <= now() AND status ='1' ORDER BY time DESC LIMIT 3)"); | |