hallo!
ich habe folgendes script geschrieben und hab dabei ein problem...
hier mal das script:
wenn ich jetzt statt
nur
dortstehen hab dann funktionieren die bedingungen.. bei if wird nur das aktuelle monat ausgegeben und bei else alles
nur wenn ich es so hab wie ich es brauch, dann funktioniert es nicht..
es funktioniert immer nur mit dem letzten if befehl... und dass ist mir irgendwie nicht durchschaubar
kann mir vielleicht wer helfen?
wär echt toll!
danke schon mal
ich habe folgendes script geschrieben und hab dabei ein problem...
hier mal das script:
Code:
<table id="t" cellspacing="0" cellpadding="0"> <tr> <td> <h2>dates</h2> </td> <td> <?php $timestamp = time(); $datep0 = date('Y-m', $timestamp); $datep1 = date('Y-m', strtotime("+1 month")); $datep2 = date('Y-m', strtotime("+2 month")); $datep3 = date('Y-m', strtotime("+3 month")); $datep4 = date('Y-m', strtotime("+4 month")); $datep5 = date('Y-m', strtotime("+5 month")); ?> <form method="post"> <select onchange="submit();" name="drop" align="right" id="s2"> <option>sort</option> <option>view all</option> <option value="<?php echo $datep0; ?>"><?php echo $datep0; ?></option> <option value="<?php echo $datep1; ?>"><?php echo $datep1; ?></option> <option value="<?php echo $datep2; ?>"><?php echo $datep2; ?></option> <option value="<?php echo $datep3; ?>"><?php echo $datep3; ?></option> <option value="<?php echo $datep4; ?>"><?php echo $datep4; ?></option> <option value="<?php echo $datep5; ?>"><?php echo $datep5; ?></option> </select> </form> </td> </tr> </table>
PHP-Code:
<?php
if($_POST['drop'] == $datep0){
$search = $datep0."%";
}
if($_POST['drop'] == $datep1){
$search = $datep1."%";
}
if($_POST['drop'] == $datep2){
$search = $datep2."%";
}
if($_POST['drop'] == $datep3){
$search = $datep3."%";
}
if($_POST['drop'] == $datep4){
$search = $datep4."%";
}
if($_POST['drop'] == $datep5){
$search = $datep5."%";
}
else{
$search = "%%";
}
$abfrage = "SELECT date, event, location, city, country, url FROM dates WHERE date LIKE '$search' ORDER BY `date` DESC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
echo "
<table id='t' cellspacing='0' cellpadding='0'>
<tr>
<td>
<h2>$row->date</h2>
<h3>$row->event</h3>
<h3>$row->location</h3>
<h3>$row->city</h3>
<h3>$row->country</h3>
[url='$row->url']$row->url[/url]
</td>
</tr>
</table>
";
}
?>
PHP-Code:
<?php
if($_POST['drop'] == $datep0){
$search = $datep0."%";
}
if($_POST['drop'] == $datep1){
$search = $datep1."%";
}
if($_POST['drop'] == $datep2){
$search = $datep2."%";
}
if($_POST['drop'] == $datep3){
$search = $datep3."%";
}
if($_POST['drop'] == $datep4){
$search = $datep4."%";
}
if($_POST['drop'] == $datep5){
$search = $datep5."%";
}
else{
$search = "%%";
}
?>
PHP-Code:
<?php
if($_POST['drop'] == $datep0){
$search = $datep0."%";
}
else{
$search = "%%";
}
?>
nur wenn ich es so hab wie ich es brauch, dann funktioniert es nicht..
es funktioniert immer nur mit dem letzten if befehl... und dass ist mir irgendwie nicht durchschaubar
kann mir vielleicht wer helfen?
wär echt toll!
danke schon mal

Kommentar