Problème d'affichage sur page suivante

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Problème d'affichage sur page suivante

rerererer

par fred9999 » 28 sept. 2006, 12:20

<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 
$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(isset($evenement2)) 
{
// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
else
{
	if(isset($departementeven)) 
	{
	$query_Recordset2.= " AND departementeven='$departementeven' ";
	}
}
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  
if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  
$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center">
		  <?php 
		  if ($pageNum_Recordset2 > 0) 
		  { 
		  // Show if not first page 
		  $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;
            echo"<a href=\"$lien\">Premier</a>";  
          } 
			?> 
			</td> 
          <td class="td2" width="31%" align="center"> 
		  <?php if ($pageNum_Recordset2 > 0) 
		  { 
		  // Show if not first page
		  $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois); 
		   echo"<a href=\"$lien\">Pr&eacute;c&eacute;dent</a>"; 
           }
			?> 
			</td> 
          <td class="td2" width="23%" align="center">
		  <?php 
		  if ($pageNum_Recordset2 < $totalPages_Recordset2) 
		  { 
		  // Show if not last page 
		  $lien="http://www.gites-ruraux-normandie.fr/evenementsdecouvertesresultat.php?pageNum_Recordset1=$pageNum_Recordset2 &totalRows_Recordset2=$totalPages_Recordset2&num_mois=$num_mois";
           echo"<a href=\"$lien\">Suivant</a>";  
          }  
			?> 
			</td> 
          <td class="td2" width="23%" align="center">
		   <?php 
		   if ($pageNum_Recordset2 < $totalPages_Recordset2) 
		   {
		   // Show if not last page
		   $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);
            echo "<a href=\"$lien\">Dernier</a>";  
            
			} 
			?>
			</td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>

par fred9999 » 28 sept. 2006, 12:02

<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 
$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(isset($evenement2)) 
{
// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
else
{
	if(isset($departementeven)) 
	{
	$query_Recordset2.= " AND departementeven='$departementeven' ";
	}
}
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  
if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  
$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center">
		  <?php 
		  if ($pageNum_Recordset2 > 0) 
		  { 
		  // Show if not first page 
		  $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;
            echo"<a href=\"$lien\">Premier</a>";  
          } 
			?> 
			</td> 
          <td class="td2" width="31%" align="center"> 
		  <?php if ($pageNum_Recordset2 > 0) 
		  { 
		  // Show if not first page
		  $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois); 
		   echo"<a href=\"$lien\">Pr&eacute;c&eacute;dent</a>"; 
           }
			?> 
			</td> 
          <td class="td2" width="23%" align="center">
		  <?php 
		  if ($pageNum_Recordset2 < $totalPages_Recordset2) 
		  { 
		  // Show if not last page 
		  $lien="http://www.gites-ruraux-normandie.fr/evenementsdecouvertesresultat.php?pageNum_Recordset1=$currentPage&totalRows_Recordset2=$totalPages_Recordset2&num_mois=$num_mois";
           echo"<a href=\"$lien\">Suivant</a>";  
          }  
			?> 
			</td> 
          <td class="td2" width="23%" align="center">
		   <?php 
		   if ($pageNum_Recordset2 < $totalPages_Recordset2) 
		   {
		   // Show if not last page
		   $lien=printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);
            echo "<a href=\"$lien\">Dernier</a>";  
            
			} 
			?>
			</td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>

par fred9999 » 28 sept. 2006, 09:48

salut, :D
il y a plus d'erreur de compilation du code alors???

alors ça doit venir de tes requetes !!!

sachant que je peut pas faire de test c'es chaud!!!

est ce que tu peut actualiser le site ou non???? pour voir ce que ça donne

et c'es reparti !! :wink:

par lafieau » 28 sept. 2006, 09:41

Salut ! :lol:
Va pas être content le fred !
Y a plusieurs problèmes :
1 - Si je choisis tous les évènements il me répond qu'il n'y a aucun enregistrement correspondant.
2 - Si je choisis autre chose comme foire par exemple, il m'affiche bien les 5 premiers enregistrements, et lorsque je fais suivant il m'affiche à nouveau les mêmes résultats.

par fred9999 » 27 sept. 2006, 16:54

<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 
$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(isset($evenement2)) 
{
// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
else
{
	if(isset($departementeven)) 
	{
	$query_Recordset2.= " AND departementeven='$departementeven' ";
	}
}
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  
if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  
$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;?>">Premier</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="31%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois);?>">Pr&eacute;c&eacute;dent</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2, $num_mois);?>">Suivant</a>  
            <?php } // Show if not last page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);?>">Dernier</a>  
            <?php } // Show if not last page ?> </td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>
BON VOILA je suis dispo demain si tu as d'autre erreurs

ok salut bonsoir

par lafieau » 27 sept. 2006, 16:51

L'erreur, j'ai oublié de la mettre ! Oups !
Notice: Undefined variable: departementeven in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 94

par fred9999 » 27 sept. 2006, 16:16

bon quelles erreurs on a maintenant ???

on a une heure pour y arriver on va le faire :!: :!: :lol:

par lafieau » 27 sept. 2006, 16:11

Désolée mais aucun changement ! :(

par fred9999 » 27 sept. 2006, 16:02

ok ok
<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 

$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(!empty($evenement2)) {// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
$query_Recordset2.= " AND departementeven='$departementeven' ";  

$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  

if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  

$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;?>">Premier</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="31%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois);?>">Pr&eacute;c&eacute;dent</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2, $num_mois);?>">Suivant</a>  
            <?php } // Show if not last page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);?>">Dernier</a>  
            <?php } // Show if not last page ?> </td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>
essaye ça pour le pb à la ligne 94

et redis moi stp

par fred9999 » 27 sept. 2006, 15:27

ok normal j'avais oublié que tu te connectais a chaque requete
<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 

$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(!empty($evenement2)) {// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
$query_Recordset2.= " AND departementeven='$departementeven' ";  

$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  

if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  

$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;?>">Premier</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="31%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois);?>">Pr&eacute;c&eacute;dent</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2, $num_mois);?>">Suivant</a>  
            <?php } // Show if not last page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);?>">Dernier</a>  
            <?php } // Show if not last page ?> </td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>
normalement ce problème est resolu passons au suivant :lol:

par lafieau » 27 sept. 2006, 15:10

Pas mieux ! :(
J'ai ce message ci maintenant :
Notice: Undefined variable: connexion in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 38

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 38

par fred9999 » 27 sept. 2006, 14:58

<?php 
include "Connections/connexion.php"; 
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"]; 
$num_mois = (isSet($_POST['num_mois'])) ? $_POST['num_mois'] : $_GET['num_mois']; 
if(isset($_POST['evenement2']) ) // si l'index existe dans $_POST   
   { 
    $evenement2 = $_POST['evenement2']; 
   }  
else // sinon   
  { 
  if(isset($_GET['evenement2'])) // si l'index existe dans $_GET   
     {  
     $evenement2 = $_GET['evenement2']; 
     }  
  } 
 if(isset($_POST['departementeven']) ) // si l'index existe dans $_POST   
   { 
    $departementeven = $_POST['departementeven']; 
   }  
else // sinon   
  { 
  if(isset($_GET['departementeven'])) // si l'index existe dans $_GET   
     {  
     $departementeven = $_GET['departementeven']; 
     }  
  }  
$maxRows_rsdepartement = 5; 
$pageNum_rsdepartement = 0; 
if (isset($HTTP_GET_VARS['pageNum_rsdepartement']))
	{ 
  $pageNum_rsdepartement = $HTTP_GET_VARS['pageNum_rsdepartement']; 
	} 
$startRow_rsdepartement = $pageNum_rsdepartement * $maxRows_rsdepartement; 

//sélection du départment
$query_rsdepartement = "SELECT distinct departement FROM tb_gite ORDER BY departement ASC"; 
$query_limit_rsdepartement = sprintf("%s LIMIT %d, %d", $query_rsdepartement, $startRow_rsdepartement, $maxRows_rsdepartement); 
$rsdepartement = mysql_query($query_limit_rsdepartement, $connexion) or die(mysql_error()); 
$row_rsdepartement = mysql_fetch_assoc($rsdepartement); 

if (isset($HTTP_GET_VARS['totalRows_rsdepartement']))
	{ 
  $totalRows_rsdepartement = $HTTP_GET_VARS['totalRows_rsdepartement']; 
	} 
else
	{ 
  $all_rsdepartement = mysql_query($query_rsdepartement); 
  $totalRows_rsdepartement = mysql_num_rows($all_rsdepartement); 
	} 
$totalPages_rsdepartement = ceil($totalRows_rsdepartement/$maxRows_rsdepartement)-1; 

 
$query_rstype = "SELECT distinct type FROM tb_gite ORDER BY type ASC"; 
$rstype = mysql_query($query_rstype, $connexion) or die(mysql_error()); 
$row_rstype = mysql_fetch_assoc($rstype); 
$totalRows_rstype = mysql_num_rows($rstype); 


$query_rscategorie = "SELECT distinct categorie FROM tb_gite ORDER BY categorie ASC"; 
$rscategorie = mysql_query($query_rscategorie, $connexion) or die(mysql_error()); 
$row_rscategorie = mysql_fetch_assoc($rscategorie); 
$totalRows_rscategorie = mysql_num_rows($rscategorie); 


$query_rs2departement = "SELECT distinct departementeven FROM tb_evenements ORDER BY departementeven ASC"; 
$rs2departement = mysql_query($query_rs2departement, $connexion) or die(mysql_error()); 
$row_rs2departement = mysql_fetch_assoc($rs2departement); 
$totalRows_rs2departement = mysql_num_rows($rs2departement); 


$query_rs2evenement = "SELECT * FROM tb_evenements ORDER BY evenement ASC"; 
$rs2evenement = mysql_query($query_rs2evenement, $connexion) or die(mysql_error()); 
$row_rs2evenement = mysql_fetch_assoc($rs2evenement); 
$totalRows_rs2evenement = mysql_num_rows($rs2evenement); 

 
$query_rsmarches = "SELECT * FROM tb_marches ORDER BY departement ASC"; 
$rsmarches = mysql_query($query_rsmarches, $connexion) or die(mysql_error()); 
$row_rsmarches = mysql_fetch_assoc($rsmarches); 
$totalRows_rsmarches = mysql_num_rows($rsmarches); 

$maxRows_Recordset2 = 5; 
$pageNum_Recordset2 = 0; 
if (isset($HTTP_GET_VARS['pageNum_Recordset2'])) { 
  $pageNum_Recordset2 = $HTTP_GET_VARS['pageNum_Recordset2']; 
} 
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2; 

$query_Recordset2 = "SELECT evenement, villeeven, descriptif, datedebut, datefin  ";  
$query_Recordset2.= " FROM tb_evenements ";  
$query_Recordset2.= " WHERE MONTH(datedebut)<=$num_mois AND MONTH(datefin)>=$num_mois ";  
if(!empty($evenement2)) {// si un événement est séléctionné, on ne ramene que les enregistrements associés à celui-ci  
  $query_Recordset2.= " AND evenement='$evenement2' ";  
}  
$query_Recordset2.= " AND departementeven='$departementeven' ";  

$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);  
$Recordset2 = mysql_query($query_limit_Recordset2, $connexion) or die(mysql_error());  
// traitement du résultat déplacé dans la boucle while  

if (isset($HTTP_GET_VARS['totalRows_Recordset2'])) {  
  $totalRows_Recordset2 = $HTTP_GET_VARS['totalRows_Recordset2'];  
} else {  
  $all_Recordset2 = mysql_query($query_Recordset2);  
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);  
}  
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;  

$queryString_Recordset2 = "";  
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {  
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);  
  $newParams = array();  
  foreach ($params as $param) {  
    if (stristr($param, "pageNum_Recordset2") == false &&  
        stristr($param, "totalRows_Recordset2") == false) {  
      array_push($newParams, $param);  
    }  
  }  
  if (count($newParams) != 0) {  
    $queryString_Recordset2 = "&" . implode("&", $newParams);  
  }  
}  
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);  
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta name="Author" lang="fr" content="gites ruraux de normandie"> 
<meta name="robots" content="index, follow"> 
<meta name="description" content="Liste des évènements selon différents critères de sélection tels que mois, département, évènement"> 
<meta name="keywords" lang="fr" content=" "> 
<title>Evènements résultat sur Gites ruraux de Normandie</title> 
<link rel="stylesheet" type="text/css" href="mafeuilledestyle.css"/> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 
</script> 
</head> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/accueiltitre_02.jpg','images/locationstitre_02.jpg','images/refgastronomietitre_02.jpg','images/servicestitre_02.jpg','images/contacttitre_02.jpg')"> 
<table width="600" height="371" border="0" align="center" cellspacing="3"> 
  <tr> 
    <td height="91" colspan="6"><div align="center"><img src="images/bandeau2-copie.jpg" width="918" height="101"></div></td> 
  </tr> 
  <tr> 
    <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('accueil','','images/accueiltitre_02.jpg',1)"><img src="images/accueiltitre_01.jpg" name="accueil" alt="Accueil" border="0"></a></td> 
    <td><a href="pagelocations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('locations','','images/locationstitre_02.jpg',1)"><img src="images/locationstitre_01.jpg" name="locations" alt="Locations" border="0"></a></td> 
    <td><img src="images/evenementtitre_02.jpg"></td> 
    <td><a href="refgastronomie.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nos references gastronomie','','images/refgastronomietitre_02.jpg',1)"><img src="images/refgastronomietitre_01.jpg" name="nos references gastronomie" alt="Nos références en gastronomie" border="0"></a></td> 
    <td><a href="services.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','images/servicestitre_02.jpg',1)"><img src="images/servicestitre_01.jpg" name="services" alt="Services" border="0"></a></td> 
    <td><a href="contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','images/contacttitre_02.jpg',1)"><img src="images/contacttitre_01.jpg" name="contact" alt="Contact" border="0"></a></td> 
  </tr> 
  <tr>  
    <td height="50" colspan="7"><p class="h1">&nbsp;</p> 
      <p class="h1">Les &eacute;v&egrave;nements</p> 
      <?php if ($totalRows_Recordset2 > 0) { // Show if recordset not empty ?> 
      <table width="600" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" cellpadding="1"> 
        <tr bgcolor="#F5CB37">  
          <td class="td1">Evénement</td> 
          <td class="td1">Descriptif</td> 
          <td class="td1">Ville</td> 
          <td class="td1">Date d&eacute;but</td> 
          <td class="td1">Date fin</td> 
          <td class="td1">Les march&eacute;s</td> 
        </tr> 
        <?php // Modification du do/while en while :  
        while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)) { // pour chaque ligne ramenée par $Recordset2  
            $row_Recordset2['datedebut']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datedebut']);  
            $row_Recordset2['datefin']= preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3.$2.$1',  $row_Recordset2['datefin']);  
         ?> 
        <tr bgcolor="#DAECA4">  
          <td class="td1"><?php echo $row_Recordset2['evenement']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['descriptif']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['villeeven']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datedebut']; ?></td> 
          <td class="td1"><?php echo $row_Recordset2['datefin']; ?></td> 
          <td class="td1"><form name="form3" method="post" action="marches.php"> 
              <a href="marches.php">Liste des march&eacute;s</a> </form></td> 
        </tr> 
        <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> 
      </table> 
      <?php } // Show if recordset not empty ?> <?php if ($totalRows_Recordset2 == 0) { // Show if recordset empty ?> 
      <p>D&eacute;sol&eacute; mais il n'y a pas d'&eacute;v&eacute;nement correspondant  
        &agrave; cette recherche</p> 
      <?php } // Show if recordset empty ?> <p class="td2">&nbsp; Enregistrements <?php echo ($startRow_Recordset2 + 1) ?> &agrave; <?php echo min($startRow_Recordset2 + $maxRows_Recordset2, $totalRows_Recordset2) ?> sur <?php echo $totalRows_Recordset2 ?>  
      <table border="0" width="50%" align="center"> 
        <tr>  
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, 0, $queryString_Recordset2, $num_mois) ;?>">Premier</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="31%" align="center"> <?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2, $num_mois);?>">Pr&eacute;c&eacute;dent</a>  
            <?php } // Show if not first page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2, $num_mois);?>">Suivant</a>  
            <?php } // Show if not last page ?> </td> 
          <td class="td2" width="23%" align="center"> <?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?> 
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s&num_mois=%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2, $num_mois);?>">Dernier</a>  
            <?php } // Show if not last page ?> </td> 
        </tr> 
      </table> 
      <form name="form1" method="post" action="evenementsdecouvertes.php"> 
        <input class="Bouton" type="submit" name="Submit2" value="Autres évènements"> 
      </form></td> 
  </tr> 
  <tr> </tr> 
</table> 
<table width="824" height="103" border="0" align="center" cellspacing="3"> 
  <tr>  
    <td height="103" colspan="2" bgcolor="#FFFFFF"> <p class="h1"align="center">Recherche  
        d'un g&icirc;te</p> 
      <form name="form2" method="post" action="resultatslocations.php"> 
        <p>D&eacute;partement  
          <select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option> 
            <?php 
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement)); 
  $rows = mysql_num_rows($rsdepartement); 
  if($rows > 0) { 
      mysql_data_seek($rsdepartement, 0); 
      $row_rsdepartement = mysql_fetch_assoc($rsdepartement); 
  } 
?> 
          </select> 
          Capacit&eacute;  
          <select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>"> 
            <?php 
do {   
?> 
            <option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option> 
            <?php 
} while ($row_rstype = mysql_fetch_assoc($rstype)); 
  $rows = mysql_num_rows($rstype); 
  if($rows > 0) { 
      mysql_data_seek($rstype, 0); 
      $row_rstype = mysql_fetch_assoc($rstype); 
  } 
?> 
          </select> 
          Cat&eacute;gorie  
          <select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>"> 
<?php 
			do { 
			?>
            <option value="<?php echo $row_rstype['categorie']?>"><?php echo $row_rstype['categorie']?></option> 
             			<?php } while ($row_rscategorie = mysql_fetch_assoc($rscategorie)); 
  $rows = mysql_num_rows($rscategorie); 
  if($rows > 0)
  { 
      mysql_data_seek($rscategorie, 0); 
      $row_rscategorie = mysql_fetch_assoc($rscategorie); 
  } 
?> 
          </select> 
          <input class="Bouton" type="submit" name="Submit" value="Rechercher"> 
        </p> 
      </form></td> 
  </tr> 
</table> 
<table width="600" border="0" align="center" cellspacing="4"> 
  <tr>  
    <td><p class="td2"><a href="index.php">Accueil</a><font color="#72A43E"> </font>|<font color="#72A43E">  
        <a href="pagelocations.php">Locations</a> </font>| <font color="f6cb37">Ev&egrave;nements  
        et d&eacute;couvertes</font> | <a href="refgastronomie.php">Nos r&eacute;f&eacute;rences  
        en gastronomie</a> | <a href="services.php">Services</a> | <a href="contact.php">Contact</a>  
        | <a href="marches.php">March&eacute;s locaux</a></p> 
      </td> 
  </tr> 
</table> 
<table width="75%" align="center"> 
  <tr> </tr> 
</table> 
<table width="75%" align="center"> 
</table> 
</body> 
</html> 
<?php 
mysql_free_result($rsdepartement); 
mysql_free_result($rstype); 
mysql_free_result($rscategorie); 
mysql_free_result($rs2departement); 
mysql_free_result($rs2evenement); 
mysql_free_result($rsmarches); 
mysql_free_result($Recordset2); 
?>
et avec ça???

par lafieau » 27 sept. 2006, 14:41

Essai N°1 avec mon ancien code, ça donne ceci :
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 269

Essai N°2 avec ton dernier bout de code :
Parse error: parse error, expecting `','' or `';'' in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 269
Ca a quand même l'air compliqué cette histoire, non ? :shock:

par fred9999 » 27 sept. 2006, 14:19

oui je sais simple essai :lol:

met ça à la place
do { 
            echo"<option value=\"".$row_rscategorie['categorie']."\"><".$row_rscategorie['categorie']".</option>";
             			} while ($row_rscategorie = mysql_fetch_assoc($rscategorie));
ou remet ton ancienne ligne pour voir [/php]

par lafieau » 27 sept. 2006, 13:53

J'ai bien fait les modif, mais j'ai encore un message d'erreur :
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\easyphp1-8\www\gitesnormandie\evenementsdecouvertesresultat.php on line 269
et la ligne 269 correspond à :
 echo"<option value=\"$row_rscategorie['categorie']\"><$row_rscategorie['categorie']</option>"; 
Pourquoi avoir modifié cette ligne, cela ne concernait pas vraiment le problème de base, non ?