salut a tous je repost mon code car le précédent été trop volumineux et contanait des info inutiles
donc je reposte mon code “allégé”
voilà j’ai un petit soucis avec le code suivant :
<?
//zk modif bouton en href pour ie 17/07/2007
$out.="<th class=column2 style='font-weight:bold'>Action</th></tr></thead>";
$tabech=array();
$tabidt=array();
$nextmonth=date("Y-m-d",mktime(0,0,0,date("m")+1,date("d"),date("Y")));
$today=date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));
//REQUETE SUR ID CANDIDATS
$result = db_query("SELECT distinct(c.id),c.nachname,c.vorname,t.status FROM candidats c, todo t, parametres p
WHERE t.deadline>'2007-05-05' and t.candidat=c.ID and c.kategorie =p.id and p.nom like 'statut' and
((p.id!=995 and p.id!=48 and t.status <>3) or (p.id=995 or p.id=48 and t.status=3))
and t.ext=".$user_ID." ".$wherec." and t.echeance is not null order by t.echeance ASC ")
or db_die();
$i=0;
while($row = db_fetch_row($result)){
$tab_rech=array();
$reqza = db_query("SELECT count(ID),recherche FROM ".DB_PREFIX."todo
WHERE suite like 'sans%' and candidat=".$row[0]." Group BY recherche")
or db_die();
while($resza=db_fetch_row($reqza)){
if($resza[0]>0 and $resza[1] !="") $tab_rech[]=$resza[1];
}
$conpteur=count($tab_rech);
if($conpteur>0){
$req10 = db_query("SELECT t.echeance,t.status,t.id FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$row[0]." and t.suite not like 'sans suite%' ".$wherec." and t.recherche NOT IN (".implode(",",$tab_rech).") ORDER BY t.deadline desc,p.ordre DESC")
or db_die();
}
else{
$req10 = db_query("SELECT t.echeance,t.status,t.id FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$row[0]." and t.suite not like 'sans suite%' ".$wherec." ORDER BY t.echeance desc,p.ordre desc,t.deadline DESC")
or db_die();
}
$res10=db_fetch_row($req10);
if($res10[1]!=3){
$tabec[]=$res10[0];
}
else if ($res10[1]==3){
$req00 = db_query("SELECT deadline FROM ".DB_PREFIX."todo
WHERE id=".$res10[2])
or db_die();
$res00=db_fetch_row($req00);
$tabec[]=$res00[0];
}
$tabidt[]="0-".$row[0]."-".$row[2]." ".$row[1];
}
//REQUETE ID CONTACTS
$result2 = db_query(" SELECT contact,deadline FROM todo WHERE ext = $user_ID and status = '3' and candidat=0 ORDER BY deadline ASC ");
while($row2=db_fetch_row($result2)){
$tabec[]=$row2[1];
$tabidt[]="1-".$row2[0];
}
$ar = array($tabec,$tabidt);
array_multisort($ar[0], SORT_ASC, SORT_STRING, $ar[1]);
$cpt=count($ar[1]);
$i=0;
$k=0;
for($j=0;$j<$cpt;$j++){
$tab_rech=array();
$var = explode("-", $ar[1][$j]);
//si candidat
if($var[0]=="0"){
//recherche des recherches où le candidats est ouvert
$reqza = db_query("SELECT count(ID),recherche FROM ".DB_PREFIX."todo
WHERE suite like 'sans%' and candidat=".$var[1]." Group BY recherche")
or db_die();
while($resza=db_fetch_row($reqza)){
if($resza[0]>0 and $resza[1] !="") $tab_rech[]=$resza[1];
}
$conpteur=count($tab_rech);
//si candidat ouvert dans au moins une recherche
if($conpteur>0){
$req1 = db_query("SELECT t.remark, t.origine_cv, t.recherche,t.echeance, t.ID,t.status,t.deadline,t.ext FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." and t.recherche NOT IN (".implode(",",$tab_rech).") ORDER BY t.deadline desc,p.ordre DESC")
or db_die();
$tmp=0;
$res1=db_fetch_row($req1);
$req10 = db_query("SELECT t.remark,t.origine_cv ,t.echeance,t.ext FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." and t.recherche NOT IN (".implode(",",$tab_rech).") ORDER BY t.echeance desc,p.ordre desc,t.deadline DESC")
or db_die();
$res10=db_fetch_row($req10);
$req101 = db_query("SELECT t.remark,t.origine_cv ,t.echeance,t.ext FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." and t.recherche NOT IN (".implode(",",$tab_rech).") ORDER BY p.ordre desc,t.deadline DESC")
or db_die();
$res101=db_fetch_row($req101);
}
//sinon
else{
$req1 = db_query("SELECT t.remark, t.origine_cv, t.recherche,t.echeance, t.ID,t.status,t.deadline,t.ext FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." ORDER BY t.deadline desc,p.ordre DESC")
or db_die();
$tmp=0;
$res1=db_fetch_row($req1);
$req10 = db_query("SELECT t.remark,t.origine_cv,t.echeance,t.ext FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like 'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." ORDER BY t.echeance desc,p.ordre desc,t.deadline DESC")
or db_die();
$res10=db_fetch_row($req10);
$req101 = db_query("SELECT t.remark,t.origine_cv ,t.echeance,t.ext,t.von FROM ".DB_PREFIX."todo t, parametres p
WHERE p.valeur = t.remark and
(p.nom like 'action_process%' or p.nom like'action_cv' ) and t.candidat = ".$var[1]." and t.suite not like 'sans suite%' ".$wherec." ORDER BY p.ordre desc,t.deadline DESC")
or db_die();
$res101=db_fetch_row($req101);
}
if($res1[0] !='' and $ $res1[0] != 'CACO' and $tmp != $res10[2] and $res101[3]==$user_ID and ($res10[2]<$nextmonth) and ($res1[6]<$nextmonth)){
//requete pour le projet auquel le candidat est affecté
$req3 = db_query("SELECT remark,project,contact,firma,ID,progress FROM ".DB_PREFIX."recherche
WHERE ID = ".$res1[2])
or db_die();
$res3 = db_fetch_row($req3);
$tmp=$res1[2];
if(!ereg("N".$res3[4],$res2[3]) and $res3[3]!='' and $res3[5]==1){
//requete pour la recherche auquel le candidat est affecté
$req4 = db_query("SELECT firma FROM ".DB_PREFIX."contacts
WHERE ID = ".$res3[3])
or db_die();
$res4 = db_fetch_row($req4);
//.....code d'affichages des candidats
}
//si contact
elseif($var[0]=="1" and !$recherche){
$req1 = db_query("SELECT t.remark, t.origine_cv, t.recherche,t.echeance, t.ID,t.status,t.deadline,t.ext FROM ".DB_PREFIX."todo t
WHERE t.contact = ".$var[1]." ".$wherec." ORDER BY t.deadline desc")
or db_die();
$tmp=0;
$res1=db_fetch_row($req1);
if($res1[7]==$user_ID and ($res1[6]<$nextmonth)){
$req2 = db_query("SELECT vorname, nachname,firma FROM ".DB_PREFIX."contacts
WHERE ID = ".$var[1])
or db_die();
$res2 = db_fetch_row($req2);
$firme=$res2[2];
$req3 = db_query("SELECT ID FROM ".DB_PREFIX."contacts
WHERE firma like '$firme' and div1 like 'e'")
or db_die();
$res3 = db_fetch_row($req3);
//...code d'affichage des contacts
}
}
}
?>
pour résumé la page met environs une minute à ce charger et il faut réactualiser la page jusqu’a cinq fois pour avoir la totalité des données affichés
si vous avez des suggestion je suis preneur.
Merci d’avance à tous
Edité le 23/10/2007 à 13:46