Operator "AND" und Probleme bei Abfrage

Tservarius

Mitglied
Hallo,
mal wieder ich mit einem Problem:

Habe ein einfaches vergleichen von Zahlen und demnach die Ausgabe, aber irgendwie will das Script noch nicht so ganz:

PHP:
If ('$stat_vote_termin1' > '$stat_vote_termin2') AND ('$stat_vote_termin1' > $'stat_vote_termin3') {
echo("$termin1");
} elseif ('$stat_vote_termin1' > '$stat_vote_termin2') AND ('$stat_vote_termin1' < '$stat_vote_termin3') {
echo("$termin3");
} elseif ('$stat_vote_termin1' < '$stat_vote_termin2') AND ('$stat_vote_termin1' > '$stat_vote_termin3') {
echo("$termin2");
}

Fehlermeldung:
Parse error: parse error, unexpected T_LOGICAL_AND

Wer kann helfen?

Thx
tserva
 
Tservarius hat gesagt.:
Hallo,
mal wieder ich mit einem Problem:

Habe ein einfaches vergleichen von Zahlen und demnach die Ausgabe, aber irgendwie will das Script noch nicht so ganz:

PHP:
If ('$stat_vote_termin1' > '$stat_vote_termin2') AND ('$stat_vote_termin1' > $'stat_vote_termin3') {
echo("$termin1");
} elseif ('$stat_vote_termin1' > '$stat_vote_termin2') AND ('$stat_vote_termin1' < '$stat_vote_termin3') {
echo("$termin3");
} elseif ('$stat_vote_termin1' < '$stat_vote_termin2') AND ('$stat_vote_termin1' > '$stat_vote_termin3') {
echo("$termin2");
}

Fehlermeldung:
Parse error: parse error, unexpected T_LOGICAL_AND

Wer kann helfen?

Thx
tserva

Naja klammersetzung ist irgendwie total falsch.
Ausserdem nimmt man da && und nicht AND ;)

PHP:
If (($stat_vote_termin1 > $stat_vote_termin2) && ($stat_vote_termin1 > $stat_vote_termin3)) {
echo("$termin1");
} elseif (($stat_vote_termin1 > $stat_vote_termin2) && ($stat_vote_termin1 < $stat_vote_termin3)) {
echo("$termin3");
} elseif (($stat_vote_termin1 < $stat_vote_termin2) && ($stat_vote_termin1 > $stat_vote_termin3)) {
echo("$termin2");
}

Achja und ich frage mich warum du die zu vergleichenden Variablen in Hochkommatas setzt ^^
 
Zurück