#1919
Grisha
Grisha
Участник

Подскажите пожалуйста как в данном запросе сделать, чтобы от одного пользователя выводилось только одно объявление?

function get_num_last_adverts($num_adv)
{
global $masConfig;
$rez=array();
$kolvo=0;
$db_add_type=””;
$db_type_sort=” sort_time “;
$t_db_query_category = “”;
$times=time();

$db_add_type=” and on_delete = ‘off’ ” ;

if ( $this->open_num_podcategory > 0 )
$t_db_query_category = $this->get_text_db_query_part_category( “advert.n_category”, $this->open_num_podcategory );

elseif ( $this->open_num_category )

$t_db_query_category = $this->get_text_db_query_part_category( “advert.n_category”, $this->open_num_category );

$db_type_sort=” RAND() “;

$db_query=”select * from “.DB_PREF.”advert advert where ”
.( $t_db_query_category ? ” ( “.$t_db_query_category.” ) and ” : “” ).” hide=’show’ $db_add_type and num_user IN(select id_user from cat_users where activ_user=’on’ and date_visit + 300 > ‘”.$times.”‘ ) and end_putdate >= “.$GLOBALS[“timeGlobal”]
.” order by “.$db_type_sort.” DESC limit 7 “;
$q_ident=obr_db_query($db_query);

while ($row = mysql_fetch_assoc($q_ident))
{
$rez[]=$row;
$kolvo++;
}
return (array($kolvo,$rez));
}
function printBlockLastTypeAdverts($kol_get_adv,$type_get_adv)
{
include(“filesmodul/forming_block_last_adv.php”);
return ($text);
}