$query="SELECT cdc.which,cdc.quand,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM cdc,prods WHERE cdc.which=prods.id AND cdc.quand<=NOW() ORDER BY cdc.quand DESC";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$cdc[]=$tmp;
}
for($i=0;$i<count($cdc);$i++):
if($cdc[$i]["group1"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$cdc[$i]["groupname1"]=$tmp["name"];
$cdc[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if($cdc[$i]["group2"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$cdc[$i]["groupname2"]=$tmp["name"];
$cdc[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if($cdc[$i]["group3"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group3"]."'";
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$cdc[$i]["which"]."' and platforms.id=prods_platforms.platform";
//$query="SELECT distinct prods.id as which,count(prods.id) as count,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM users WHERE (users.cdc=prods.id OR users.cdc2=prods.id OR users.cdc3=prods.id OR users.cdc4=prods.id OR users.cdc5=prods.id) group by prods.id order by count desc";
//$result=mysql_query($query);
//while($tmp=mysql_fetch_array($result)) {
// $pcdc[]=$tmp;
//}
// include('include/cdclist.cache.inc');
// $pcdc = $cdclist;
$query=" SELECT distinct prods.id as which,count(prods.id) as count,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM users_cdcs JOIN prods WHERE users_cdcs.cdc=prods.id group by prods.id order by count desc";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$pcdc[]=$tmp;
}
for($i=0;$i<count($pcdc);$i++):
if($pcdc[$i]["group1"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$pcdc[$i]["groupname1"]=$tmp["name"];
$pcdc[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if($pcdc[$i]["group2"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$pcdc[$i]["groupname2"]=$tmp["name"];
$pcdc[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if($pcdc[$i]["group3"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group3"]."'";
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$pcdc[$i]["which"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$pcdc[$i]["platform"]="";
while($tmp=mysql_fetch_array($result)){
if($check>0)$pcdc[$i]["platform"].=",";
$check++;
$pcdc[$i]["platform"].=$tmp["name"];
}
endfor;
/*
//sceneorgrecommended check
$result=mysql_query("SELECT sceneorgrecommended.prodid, sceneorgrecommended.type, sceneorgrecommended.category, prods.name,prods.type,prods.group1,prods.group2,prods.group3 from sceneorgrecommended LEFT JOIN prods ON prods.id=sceneorgrecommended.prodid WHERE sceneorgrecommended.type='viewingtip' ORDER BY prods.date");
while($tmp=mysql_fetch_array($result)){
$rec[]=$tmp;
}
for($i=0;$i<count($rec);$i++):
if($rec[$i]["group1"]):
$query="select name,acronym from groups where id='".$rec[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$rec[$i]["groupname1"]=$tmp["name"];
$rec[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if($rec[$i]["group2"]):
$query="select name,acronym from groups where id='".$rec[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)){
$rec[$i]["groupname2"]=$tmp["name"];
$rec[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if($rec[$i]["group3"]):
$query="select name,acronym from groups where id='".$rec[$i]["group3"]."'";
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$rec[$i]["prodid"]."' and platforms.id=prods_platforms.platform";