Bonjour je suis completement perdu dans mon code,mon probleme c'est juste de la logique,l'ennui c'est qu'a force de travailler sur ce code je deviens completement gaga
En fait ce que je cherche a faire depuis le debut c'est :
WHERE (pr.PerfName="Valeur choisie")AND(pr.TypePerf="Performer" OR pr.TypePerf="Panel" OR pr.TypePerf="Workshop") AND (pr.PerfCodeName="Valeur choisie" )AND (pf.Date="5/26/2006" OR pf.Date="5/27/2006" OR pf.Date="5/28/2006" OR pf.Date="5/29/2006")AND (pf.Start="Valeur choisie") AND (pf.End="valeur choisie") AND (pl.Stage="Valeur choisie") AND (pl.LocStage="Outdoor" OR pl.LocStage="Indoor")
avec le code suivant mais je ne vois vraiment pas comment faire(j'ai esseye mille et une combinaisons de parentheses),pouvez vous m'aider s'il vous plait?:
<?php
array('Performer', 'Panel','Workshop');
array('5/26/2006','5/27/2006','5/28/2006','5/29/2006');
array('Indoor', 'Outdoor');
$where = 'WHERE (';
$and=false; //au départ aucun type d'information n'a été détécté
if(ISSET($_POST['perfname'])&&$_POST['perfname']!='')
{$where = $where.' (pr.PerfName="'.$_POST['perfname'].'"';
$and=true;}
if(isset($_POST['typeperf']) AND is_array($_POST['typeperf']))
{
foreach($_POST['typeperf'] AS $valeur)
{
if(ISSET($_POST['typeperf'])&&$_POST['typeperf']!='')
{if($and) $where = $where.' OR ';
$where = $where.' pr.TypePerf="'.$valeur.'"';
$and=true;}}
$where = $where . ') '; }
if(ISSET($_POST['perfcodename'])&&$_POST['perfcodename']!='')
{if($and) $where = $where.' AND ';
$where = $where.' pr.PerfCodeName="'.$_POST['perfcodename'].'"';
$and=true;}
if(isset($_POST['date']) AND is_array($_POST['date']))
{
foreach($_POST['date'] AS $valeur2)
{
if(ISSET($_POST['date'])&&$_POST['date']!='')
{if($and) $where = $where.' OR ';
$where = $where.' pf.Date="'.$valeur2.'"';
$and=true;}}
$where = $where . ') '; }
if(ISSET($_POST['start'])&&$_POST['start']!='')
{if($and) $where = $where.' AND ';
$where = $where.' pf.Start="'.$_POST['start'].'"';
$and=true;}
if(ISSET($_POST['end'])&&$_POST['end']!='')
{if($and) $where = $where.' AND ';
$where = $where.' pf.End="'.$_POST['end'].'"';
$and=true;}
if(ISSET($_POST['stage'])&&$_POST['stage']!='')
{if($and) $where = $where.' AND ';
$where = $where.' pl.Stage="'.$_POST['stage'].'"';
$and=true;}
if(isset($_POST['locstage']) AND is_array($_POST['locstage']))
{
foreach($_POST['locstage'] AS $valeur3)
{
if(ISSET($_POST['locstage'])&&$_POST['locstage']!='')
{if($and) $where = $where.' OR ';
$where = $where.' pl.LocStage="'.$valeur3.'"';
$and=true;}}
$where = $where . ') '; }
if($and!=true) $where = $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";
?>

