Bonjour a tous et bonnes fêtes de fin d'année, ...
J'ai un soucis sur la page suivante :
http://southrider.fr/pg/pg/support.php? … agne#liste
Comme vous pouvez le voir, a peu près tout fonctionne sur les recherches sauf 2 "trucs" !
- La recherche par région, sauf s'il s'agit de la région Aquitaine (les autres ne fonctionne pas ! Pourquoi, voila la question ... ?)
- La recherche par département mais uniquement sur le département "Espagne" (dans le champ "dep" est normalement ecrit le numéro du département, sauf pour l'Espagne ou j'ai marqué "Espagne" ... comprend pas pourquoi il veux pas le prendre, il me semble pourtant que la table sql est correcte ...)
Si certain on des idées ...
Un grand merci d'avance,
Profitez bien des vacances,
Pascal
Voici le code php pour toute les recherches :
(oui c'est un peu lourd, ... il y a un affichage sur 2 colonnes pour la 1er partie)
Encore en dessous, il y la prise d'écran de la table sql
//Calcul des limites
if ($affichage == liste)
{
switch($choix)
{
case 'tout':
$rq = "select distinct id from tbl_circuit where type='MX' order by id";
break;
case 'ufolep':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ufolep' or type='MX' and licence='everybody'
order by id";
break;
case 'ffm':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ffm' or type='MX' and licence='everybody'
order by id";
break;
case 'alfa':
$rq = "select distinct id from tbl_circuit where type='MX' order by lieu";
break;
case 'ufolep-alfa':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ufolep' or type='MX' and licence='everybody'
order by lieu";
break;
case 'ffm-alfa':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ffm' or type='MX' and licence='everybody'
order by lieu";
break;
case 'dep':
$rq = "select distinct id from tbl_circuit where type='MX'
order by dep";
break;
case 'ufolep-dep':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ufolep' or type='MX' and licence='everybody'
order by dep";
break;
case 'ffm-dep':
$rq = "select distinct id from tbl_circuit where type='MX' and licence='ffm' or type='MX' and licence='everybody'
order by dep";
break;
case 'dep2':
$rq = 'select distinct id from tbl_circuit
where type="MX" and dep='.$choix2.'
order by lieu';
break;
case 'region':
switch($choix2)
{
case 'aquitaine':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="24" or
type="MX" and dep="33" or
type="MX" and dep="40" or
type="MX" and dep="47" or
type="MX" and dep="64"
order by lieu';
break;
case 'auvergne':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="03" or
type="MX" and dep="15" or
type="MX" and dep="43" or
type="MX" and dep="63"
order by lieu';
echo 'Bloque 0<br>';
break;
case 'languedoc':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="11" or
type="MX" and dep="30" or
type="MX" and dep="34" or
type="MX" and dep="48" or
type="MX" and dep="66"
order by lieu';
break;
case 'limousin':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="19" or
type="MX" and dep="23" or
type="MX" and dep="87"
order by lieu';
break;
case 'midipy':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="09" or
type="MX" and dep="12" or
type="MX" and dep="31" or
type="MX" and dep="32" or
type="MX" and dep="46" or
type="MX" and dep="65" or
type="MX" and dep="81" or
type="MX" and dep="82"
order by lieu';
break;
case 'poitou':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="16" or
type="MX" and dep="17" or
type="MX" and dep="79" or
type="MX" and dep="86"
order by lieu';
break;
case 'provence':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="04" or
type="MX" and dep="05" or
type="MX" and dep="06" or
type="MX" and dep="13" or
type="MX" and dep="84"
order by lieu';
break;
case 'rhone':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="01" or
type="MX" and dep="07" or
type="MX" and dep="26" or
type="MX" and dep="38" or
type="MX" and dep="42" or
type="MX" and dep="69" or
type="MX" and dep="73" or
type="MX" and dep="74"
order by lieu';
break;
}
break;
default:
$rq = "select distinct id from tbl_circuit where type='MX' order by lieu";
}
}
else
{
$rq = "select distinct id from tbl_circuit where type='MX' order by lieu";
}
$result = mysql_query($rq) or die ("Affichage des circuits impossibles");
$nbre_mx = mysql_num_rows($result);
$limite1 = round($nbre_mx / 2);
$limite2 = $nbre_mx - 1;
//affichage 1ere partie
if ($affichage == liste)
{
switch($choix)
{
case 'tout':
$rq = 'select distinct id from tbl_circuit where type="MX" order by id limit 0,'.$limite1.'';
break;
case 'ufolep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by id limit 0,'.$limite1.'';
break;
case 'ffm':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by id limit 0,'.$limite1.'';
break;
case 'alfa':
$rq = 'select distinct id from tbl_circuit where type="MX" order by lieu limit 0,'.$limite1.'';
break;
case 'ufolep-alfa':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by lieu limit 0,'.$limite1.'';
break;
case 'ffm-alfa':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by lieu limit 0,'.$limite1.'';
break;
case 'dep':
$rq = 'select distinct id from tbl_circuit where type="MX" order by dep limit 0,'.$limite1.'';
break;
case 'ufolep-dep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by dep limit 0,'.$limite1.'';
break;
case 'ffm-dep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by dep limit 0,'.$limite1.'';
break;
case 'dep2':
$rq = 'select distinct id from tbl_circuit
where type="MX" and dep='.$choix2.'
order by lieu limit 0,'.$limite1.'';
break;
case 'region':
switch($choix2)
{
case 'aquitaine':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="24" or
type="MX" and dep="33" or
type="MX" and dep="40" or
type="MX" and dep="47" or
type="MX" and dep="64"
order by lieu limit 0,'.$limite1.'';
break;
case 'auvergne':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="03" or
type="MX" and dep="15" or
type="MX" and dep="43" or
type="MX" and dep="63"
order by lieu limit 0,'.$limite1.'';
echo 'Bloque 1<br>';
break;
case 'languedoc':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="11" or
type="MX" and dep="30" or
type="MX" and dep="34" or
type="MX" and dep="48" or
type="MX" and dep="66"
order by lieu limit 0,'.$limite1.'';
break;
case 'limousin':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="19" or
type="MX" and dep="23" or
type="MX" and dep="87"
order by lieu limit 0,'.$limite1.'';
break;
case 'midipy':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="09" or
type="MX" and dep="12" or
type="MX" and dep="31" or
type="MX" and dep="32" or
type="MX" and dep="46" or
type="MX" and dep="65" or
type="MX" and dep="81" or
type="MX" and dep="82"
order by lieu limit 0,'.$limite1.'';
break;
case 'poitou':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="16" or
type="MX" and dep="17" or
type="MX" and dep="79" or
type="MX" and dep="86"
order by lieu limit 0,'.$limite1.'';
break;
case 'provence':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="04" or
type="MX" and dep="05" or
type="MX" and dep="06" or
type="MX" and dep="13" or
type="MX" and dep="84"
order by lieu limit 0,'.$limite1.'';
break;
case 'rhone':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="01" or
type="MX" and dep="07" or
type="MX" and dep="26" or
type="MX" and dep="38" or
type="MX" and dep="42" or
type="MX" and dep="69" or
type="MX" and dep="73" or
type="MX" and dep="74"
order by lieu limit 0,'.$limite1.'';
break;
}
break;
default:
$rq = 'select distinct id from tbl_circuit where type="MX" order by lieu limit 0,'.$limite1.'';
}
}
else
{
$rq = 'select distinct id from tbl_circuit where type="MX" order by lieu limit 0,'.$limite1.'';
}
$result = mysql_query($rq) or die ("Affichage des circuits impossibles");
while ($ligne = mysql_fetch_array($result))
{
extract($ligne);
if ($id != "")
{
$sql = "select * from tbl_circuit where id='$id'";
$req = mysql_query($sql) or die ("Lecture des données impossible");
$data = mysql_fetch_array($req);
$lieu = $data['lieu'];
$dep = $data['dep'];
echo '<a href="../pg/support.php?rub=circuit-indv&id='.$id.'" class="texte">'.$lieu.' ('.$dep.')</a>';
echo '<br>';
}
}
?>
</td>
<td width="12" align="left" valign="top"> </td>
<td width="225" align="left" valign="top"><br />
<?php
//affichage 2eme partie
echo '<br />';
if ($affichage == liste)
{
switch($choix)
{
case 'tout':
$rq = 'select distinct id from tbl_circuit where type="MX"
order by id limit '.$limite1.','.$limite2.'';
break;
case 'ufolep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by id limit '.$limite1.','.$limite2.'';
break;
case 'ffm':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by id limit '.$limite1.','.$limite2.'';
break;
case 'alfa':
$rq = 'select distinct id from tbl_circuit where type="MX"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'ufolep-alfa':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'ffm-alfa':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'dep':
$rq = 'select distinct id from tbl_circuit where type="MX"
order by dep limit '.$limite1.','.$limite2.'';
break;
case 'ufolep-dep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ufolep" or type="MX" and licence="everybody"
order by dep limit '.$limite1.','.$limite2.'';
break;
case 'ffm-dep':
$rq = 'select distinct id from tbl_circuit where type="MX" and licence="ffm" or type="MX" and licence="everybody"
order by dep limit '.$limite1.','.$limite2.'';
break;
case 'dep2':
$rq = 'select distinct id from tbl_circuit
where type="MX" and dep='.$choix2.'
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'region':
switch($choix2)
{
case 'aquitaine':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="24" or
type="MX" and dep="33" or
type="MX" and dep="40" or
type="MX" and dep="47" or
type="MX" and dep="64"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'auvergne':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="03" or
type="MX" and dep="15" or
type="MX" and dep="43" or
type="MX" and dep="63"
order by lieu limit '.$limite1.','.$limite2.'';
echo 'Bloque 2<br>';
break;
case 'languedoc':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="11" or
type="MX" and dep="30" or
type="MX" and dep="34" or
type="MX" and dep="48" or
type="MX" and dep="66"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'limousin':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="19" or
type="MX" and dep="23" or
type="MX" and dep="87"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'midipy':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="09" or
type="MX" and dep="12" or
type="MX" and dep="31" or
type="MX" and dep="32" or
type="MX" and dep="46" or
type="MX" and dep="65" or
type="MX" and dep="81" or
type="MX" and dep="82"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'poitou':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="16" or
type="MX" and dep="17" or
type="MX" and dep="79" or
type="MX" and dep="86"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'provence':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="04" or
type="MX" and dep="05" or
type="MX" and dep="06" or
type="MX" and dep="13" or
type="MX" and dep="84"
order by lieu limit '.$limite1.','.$limite2.'';
break;
case 'rhone':
$rq = 'select distinct id from tbl_circuit where
type="MX" and dep="01" or
type="MX" and dep="07" or
type="MX" and dep="26" or
type="MX" and dep="38" or
type="MX" and dep="42" or
type="MX" and dep="69" or
type="MX" and dep="73" or
type="MX" and dep="74"
order by lieu limit '.$limite1.','.$limite2.'';
break;
}
break;
default:
$rq = 'select distinct id from tbl_circuit where type="MX" order by lieu limit '.$limite1.','.$limite2.'';
}
}
else
{
$rq = 'select distinct id from tbl_circuit where type="MX" order by lieu limit '.$limite1.','.$limite2.'';
}
echo 'Bloque entre 2 et 3<br />';
$result = mysql_query($rq) or die ("Affichage des circuits impossibles");
echo 'Bloque entre 2 et 3 bis<br />';
//affichage
while ($ligne = mysql_fetch_array($result))
{
extract($ligne);
if ($id != "")
{
$sql = "select * from tbl_circuit where id='$id'";
$req = mysql_query($sql) or die ("Lecture des données impossible");
$data = mysql_fetch_array($req);
$lieu = $data['lieu'];
$dep = $data['dep'];
echo '<a href="../pg/support.php?rub=circuit-indv&id='.$id.'" class="texte">'.$lieu.' ('.$dep.')</a>';
echo '<br>';
}
}
?>
</td>
<td width="12" align="left" valign="top"> </td>
<td width="225" align="left" valign="top">
<img src="../../img-work/sous-titre/circuit/type-sx.jpg" /><br />
<?php
//recuperation des donnees sur la base SQL
if ($affichage == liste)
{
switch($choix)
{
case 'tout':
$rq = "select distinct id from tbl_circuit where type='SX'
order by id";
break;
case 'ufolep':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ufolep' or type='SX' and licence='everybody'
order by id";
break;
case 'ffm':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ffm' or type='SX' and licence='everybody'
order by id";
break;
case 'alfa':
$rq = "select distinct id from tbl_circuit where type='SX'
order by lieu";
break;
case 'ufolep-alfa':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ufolep' or type='SX' and licence='everybody'
order by lieu";
break;
case 'ffm-alfa':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ffm' or type='SX' and licence='everybody'
order by lieu";
break;
case 'dep':
$rq = "select distinct id from tbl_circuit where type='SX'
order by dep";
break;
case 'ufolep-dep':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ufolep' or type='SX' and licence='everybody'
order by dep";
break;
case 'ffm-dep':
$rq = "select distinct id from tbl_circuit where type='SX' and licence='ffm' or type='SX' and licence='everybody'
order by dep";
break;
case 'dep2':
$rq = 'select distinct id from tbl_circuit
where type="SX" and dep='.$choix2.'
order by lieu';
break;
case 'region':
switch($choix2)
{
case 'aquitaine':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="24" or
type="SX" and dep="33" or
type="SX" and dep="40" or
type="SX" and dep="47" or
type="SX" and dep="64"
order by lieu';
break;
case 'auvergne':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="03" or
type="SX" and dep="15" or
type="SX" and dep="43" or
type="SX" and dep="63"
order by lieu';
break;
case 'languedoc':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="11" or
type="SX" and dep="30" or
type="SX" and dep="34" or
type="SX" and dep="48" or
type="SX" and dep="66"
order by lieu';
break;
case 'limousin':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="19" or
type="SX" and dep="23" or
type="SX" and dep="87"
order by lieu';
break;
case 'midipy':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="09" or
type="SX" and dep="12" or
type="SX" and dep="31" or
type="SX" and dep="32" or
type="SX" and dep="46" or
type="SX" and dep="65" or
type="SX" and dep="81" or
type="SX" and dep="82"
order by lieu';
break;
case 'poitou':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="16" or
type="SX" and dep="17" or
type="SX" and dep="79" or
type="SX" and dep="86"
order by lieu';
break;
case 'provence':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="04" or
type="SX" and dep="05" or
type="SX" and dep="06" or
type="SX" and dep="13" or
type="SX" and dep="84"
order by lieu';
break;
case 'rhone':
$rq = 'select distinct id from tbl_circuit where
type="SX" and dep="01" or
type="SX" and dep="07" or
type="SX" and dep="26" or
type="SX" and dep="38" or
type="SX" and dep="42" or
type="SX" and dep="69" or
type="SX" and dep="73" or
type="SX" and dep="74"
order by lieu';
break;
}
break;
default:
$rq = "select distinct id from tbl_circuit where type='SX' order by lieu";
}
}
else
{
$rq = "select distinct id from tbl_circuit where type='SX' order by lieu";
}
$result = mysql_query($rq) or die ("Affichage des circuits impossibles");
//affichage
while ($ligne = mysql_fetch_array($result))
{
extract($ligne);
if ($id != "")
{
$sql = "select * from tbl_circuit where id='$id'";
$req = mysql_query($sql) or die ("Lecture des données impossible");
$data = mysql_fetch_array($req);
$lieu = $data['lieu'];
$dep = $data['dep'];
echo '<a href="../pg/support.php?rub=circuit-indv&id='.$id.'" class="texte">'.$lieu.' ('.$dep.')</a>';
echo '<br>';
}
}
?>
<br />
<br />
<img src="../../img-work/sous-titre/circuit/perso.jpg" /><br />
<?php
//recuperation des donnees sur la base SQL
$rq = "select distinct id from tbl_circuit where type='perso' order by lieu";
$result = mysql_query($rq) or die ("Affichage des circuits impossibles");
//affichage
while ($ligne = mysql_fetch_array($result))
{
extract($ligne);
if ($id != "")
{
$sql = "select * from tbl_circuit where id='$id'";
$req = mysql_query($sql) or die ("Lecture des données impossible");
$data = mysql_fetch_array($req);
$lieu = $data['lieu'];
$dep = $data['dep'];
echo '<a href="../pg/support.php?rub=circuit-indv&id='.$id.'" class="texte">'.$lieu.'</a>';
echo '<br>';
}
}
//fermeture de la connection SQL
mysql_close();
?>
Dernière modification par squal (26-12-2009 21:34:11)