Hallo und Guten Tag.
Ich lasse mir von Seite 2 $country übergeben.
Ich lasse mir von Seite 3 $months übergeben.
Beides sind Auswahllisten, die entweder mit Werten gefüllt sind, als option
value, oder haben als value='all', dann sind alle ausgewählt.
Jetzt möchte ich auf Seite 4 eine Abfrage machen, die abhängig ist von den Daten von Seite 2 und Seite 3. Leider macht er nicht das was ich möchte, habe ich ein Fehler in meiner IF-Anweisung ?
PHP-Code:
<?php
If ($months=='all' && $country!='all'){
echo "Funktioniert";
$result = mysql_query("SELECT p.*, s.* FROM
project_spec p, speciality s WHERE p.country='$country'
and p.icd_id='$icd_id' and p.speciality_id=s.speciality_id
Group by s.speciality_name");
}
elseif ($country=='all' && $months!='all'){
echo "Funktioniert2";
$result = mysql_query("SELECT p.*, s.* FROM project_spec
p, speciality s WHERE p.icd_id='$icd_id' and p.speciality_id=
s.speciality_id and p.create_time
IN ('".implode("','", $array2)."')
Group by s.speciality_name");
}
elseif ($months=='all' && $country=='all'){
echo "Funktioniert3";
$result = mysql_query("SELECT p.*, s.* FROM project_spec
p, speciality s WHERE p.icd_id='$icd_id' and p.speciality_id=
s.speciality_id Group by s.speciality_name");
}
else
{
echo "Funktioniert4";
$result = mysql_query("SELECT p.*, s.* FROM project_spec
p, speciality s WHERE p.country='$country' and p.icd_id='$icd_id'
and p.speciality_id=s.speciality_id and p.create_time
IN ('".implode("','", $array2)."') Group by s.speciality_name");
}
$num = mysql_num_rows($result);
if ($num != 0)
{
...................................
?>