I am using the select distinct query but i guess the problem i have is that i need info from other tables and the select distinct does not work anymore since it does not now on wich table to use it.
Here is my code:
$flg=0;
$strsql="SELECT distinct u.userid, m.id as member_id, m.login, m.age, m.gender, c.name as country, l.name as language, v.name as state, p.id, u.timestamp, p.lastlogin
FROM dt_usersonline u ,dt_members m ,dt_profile p ,dt_countries c ,dt_states v, dt_languages l
WHERE u.userid=p.member_id AND u.userid=m.id AND p.state=v.id AND p.country=c.id AND p.lang_1=l.id AND p.status='1' AND (u.login <> '')and(u.timestamp>$timeout)";
if($strgender!="") {
$strsql.=" AND m.gender='".$strgender."'";
}
if($strstate!="")
{
$strsql.=" AND p.state='".$strstate."'";
}
if($strlanguage!="")
{
$strsql.=" AND p.lang_1='".$strlanguage."'";
}
if($stragefrom!="" and $strageto!="")
{
$strsql.=" AND (m.age BETWEEN ".$stragefrom." AND ".$strageto.")";
}
The select distinct should work at the dt_usersonline table.
Any idea on how to rewrite so it does not gives me the same output more then 1 time..
Thanks
Marc