Bonjour,
Essaye cela, je ne sais pas si ça va marcher, je n'ai pas modifier grand chose...
<?php
array('Performer', 'Panel','Workshop');
array('5/26/2006','5/27/2006','5/28/2006','5/29/2006');
array('Indoor', 'Outdoor');
$where = 'WHERE (';
unset($exp); // on libère la variable au cas où elle existe et possède une valeur
if( ISSET($_POST['perfname']) && $_POST['perfname'] != '' )
{
$exp = ' (pr.PerfName="'.$_POST['perfname'].'"';
}
$where .= $exp;
if($exp){$exp = '';}
if( isset($_POST['typeperf']) AND is_array($_POST['typeperf']) )
{
foreach($_POST['typeperf'] AS $valeur)
{
if( ISSET($_POST['typeperf']) && $_POST['typeperf'] != '' )
{
if($exp) $exp .= ' OR ';
$exp .= ' pr.TypePerf="'.$valeur.'"';
}
}
$where .= $exp . ') ';
}
if($exp){$exp = '';}
if( ISSET($_POST['perfcodename']) && $_POST['perfcodename'] != '' )
{
if($exp) $exp .= ' AND ';
$exp .= ' pr.PerfCodeName="'.$_POST['perfcodename'].'"';
}
$where .= $exp;
if($exp){$exp='');
if( isset($_POST['date']) AND is_array($_POST['date']) )
{
foreach($_POST['date'] AS $valeur2)
{
if(ISSET($_POST['date']) && $_POST['date'] != '' )
{
if($exp) $exp .= ' OR ';
$exp .=' pf.Date="'.$valeur2.'"';
}
}
$where .= $exp . ') ';
}
if($exp){$exp='');
if(ISSET($_POST['start']) && $_POST['start'] != '' )
{
if($exp) $exp .= ' AND ';
$exp .= ' pf.Start="'.$_POST['start'].'"';
}
$where .= $exp;
if($exp){$exp='');
if( ISSET($_POST['end']) && $_POST['end'] != '' )
{
if($exp) $exp .= ' AND ';
$exp = ' pf.End="'.$_POST['end'].'"';
}
$where .= $exp;
if($exp){$exp='');
if( ISSET($_POST['stage']) && $_POST['stage'] != '' )
{
if($exp) $exp .= ' AND ';
$exp .= ' pl.Stage="'.$_POST['stage'].'"';
}
$where .= $exp;
if($exp){$exp='');
if(isset($_POST['locstage']) AND is_array($_POST['locstage']))
{
foreach($_POST['locstage'] AS $valeur3)
{
if(ISSET($_POST['locstage'])&&$_POST['locstage']!='')
{
if($exp) $exp .= ' OR ';
$exp .= ' pl.LocStage="'.$valeur3.'"';
}
}
$where = $exp . ') ';
}
if($exp){$exp='');
if( !$exp ) $where .= ' 1';
$q = 'SELECT pr.*,
pf.*,
pl.*
FROM performer AS pr
INNER JOIN performance AS pf ON pr.IDPerf=pf.IDPerf
INNER JOIN place AS pl ON pl.CodeStage=pf.CodeStage '.$where;
echo "$q";
/*
Je ne sais pas si ça va marcher mais bon essaye quad même ...
*/
?>
<?php
/*
Pour ma part j'utiliserais les fonctions currnet, key et next pour naviguer dans les tableaux
*/
do{
$val = current($_POST['tostageto']); // on recupère la valeur de la case du tableau
$key = key($_POST['stage']); // on résupère la clé
if($exp) $exp .= ' OR ';
$exp .= ' pl.LocStage="'.$val.'"';
}while(!next($_POST['stage']));
$where .= $exp.') ';
?>


