Location: PHPKode > projects > paperasse > paperasse/rechercher_resultat.php
<?php
# ---------------------------------------
# Paperasse (c) 2006 Guillaume BETTAYEB
# mail and documents management web page
# hide@address.com
# ---------------------------------------
@include_once('paperasse.conf.php');

function Resultat($table,$motcle){
	switch($table){
		case 'papiers':
			echo '<tr class="bouton"><td>N°</td><td>DOSSIER</td><td>MODALITE</td><td>DATE</td><td>OBJET</td></tr>';
			$query	= "SELECT * FROM `papiers` WHERE `objet` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				$split  = split('-',$datepapier);
				$date	= $split[2].'/'.$split[1].'/'.$split[0];
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_papier&id=$id\">$id</a></td><td>$dossier</td><td>$modalite</td><td>$date</td><td>$objet</td></tr>";
			}
		break;
		case 'traitements';
			echo '<tr class="bouton"><td>ID</td><td>DOCUMENT</td><td>GROUPE</td><td>DATE MAX</td><td>UTILISATEUR</td><td>NOTE</td></tr>';
			$query	= "SELECT * FROM `traitements` WHERE `note` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				$split  = split('-',$datemax);
				$date	= $split[2].'/'.$split[1].'/'.$split[0];
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_traitement&id=$id\">$id</a></td><td>$id_doc</td><td>$id_grp</td><td>$date</td><td>$utilisateur</td><td>$note</td></tr>";
			}
		break;
		case 'utilisateurs';
			echo '<tr class="bouton"><td>NOM</td></tr>';
			$query	= "SELECT * FROM `utilisateurs` WHERE `nom` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_utilisateur&id=$id\">$nom</a></td></tr>";
			}
		break;
		case 'grp_traitements';
		echo '<tr class="bouton"><td>NOM</td></tr>';
			$query	= "SELECT * FROM `grp_traitements` WHERE `nom` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_grp_traitement&id=$id\">$nom</a></td></tr>";
			}
		break;
		case 'factures';
		echo '<tr class="bouton"><td>ID</td><td>CONTACT</td><td>UTILISATEUR</td><td>DOSSIER</td><td>MONTANT</td><td>DATE DE SAISIE</td><td>DATE DE FACTURATION</td></tr>';
			$query	= "SELECT * FROM `factures` WHERE `contact` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				$split  = split('-',$date);
				$date	= $split[2].'/'.$split[1].'/'.$split[0];
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_facture&id=$id\">$id</a></td><td>$contact</td><td>$utilisateur</td><td>$dossier</td><td>$montant</td><td>$date</td><td>".InverserDate(str_replace('-','/',$datefacture))."</td></tr>";
			}
		break;
		case 'dossiers';
		echo '<tr class="bouton"><td>NOM</td><td>COULEUR</td></tr>';
			$query	= "SELECT * FROM `dossiers` WHERE `nom` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_dossier&id=$id\">$nom</a></td><td bgcolor=\"$couleur\"></td></tr>";
			}
		break;
		case 'contacts';
		echo '<tr class="bouton"><td>NOM</td><td>NUM</td><td>RUE</td><td>BOITE POSTALE</td><td>CEDEX</td><td>CODE POSTAL</td><td>VILLE</td></tr>';
			$query	= "SELECT * FROM `contacts` WHERE `nom` LIKE '%$motcle%'";
			$sql	= mysql_query($query) OR die(mysql_error());
			while($array = mysql_fetch_array($sql,MYSQL_ASSOC)){
				extract($array);
				echo "<tr class=\"texte\"><td><a href=\"index.php?page=ajouter_contact&id=$id\">$nom</a></td><td>$num</td><td>$rue</td><td>$bp</td><td>$cdx</td><td>$cp</td><td>$ville</td></tr>";
			}
		break;
	}
}
?>
<div align="center">
  <table width="70%" border="0" cellpadding="5" cellspacing="5" class="tableau">
    <tr> 
      <td colspan="5"><div class="texte"> 
          <div align="center">RESULTATS DE LA RECHERCHE</div>
        </div></td>
    </tr>
    <tr class="bouton"> 
	  </tr>
	  <?php Resultat($HTTP_POST_VARS['table'],$HTTP_POST_VARS['motcle'])?> 
    </tr>
  </table>
</div>
Return current item: paperasse