Hi habe folgendes Problem (Quellcode siehe unten) Möchte gerne diesen Code vereinfachen damit ich di Suchergebnisse Alphapetisch Ordnen.
$query = "select * from detail where produkt1 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID = @mysql_query($query);
while ($data = mysql_fetch_array($resultID))
{
echo ' <a href=produkte.php?id='.$data["id"].'><font face="Verdana" size="-1"><b>'.$data["produkt1"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data["Firma"].' ['.$data["Ort"].']</b></font><br>';
}
$query1 = "select * from detail where produkt2 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%') ";
$resultID1 = @mysql_query($query1);
while ($data1 = mysql_fetch_array($resultID1))
{
echo ' <a href=produkte.php?id='.$data1["id"].'><font face="Verdana" size="-1"><b>'.$data1["produkt2"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data1["Firma"].' ['.$data1["Ort"].']</b></font><br>';
}
$query2 = "select * from detail where produkt3 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID2 = @mysql_query($query2);
while ($data2 = mysql_fetch_array($resultID2))
{
echo ' <a href=produkte.php?id='.$data2["id"].'><font face="Verdana" size="-1"><b>'.$data2["produkt3"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data2["Firma"].' ['.$data2["Ort"].']</b></font><br>';
}
$query3 = "select * from detail where produkt4 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID3 = @mysql_query($query3);
while ($data3 = mysql_fetch_array($resultID3))
{
echo ' <a href=produkte.php?id='.$data3["id"].'><font face="Verdana" size="-1"><b>'.$data3["produkt4"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data3["Firma"].' ['.$data3["Ort"].']</b></font><br>';
}
$query4 = "select * from detail where produkt5 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID4 = @mysql_query($query4);
while ($data4 = mysql_fetch_array($resultID4))
{
echo ' <a href=produkte.php?id='.$data4["id"].'><font face="Verdana" size="-1"><b>'.$data4["produkt5"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data4["Firma"].' ['.$data4["Ort"].']</b></font><br>';
}
$query = "select * from detail where produkt1 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID = @mysql_query($query);
while ($data = mysql_fetch_array($resultID))
{
echo ' <a href=produkte.php?id='.$data["id"].'><font face="Verdana" size="-1"><b>'.$data["produkt1"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data["Firma"].' ['.$data["Ort"].']</b></font><br>';
}
$query1 = "select * from detail where produkt2 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%') ";
$resultID1 = @mysql_query($query1);
while ($data1 = mysql_fetch_array($resultID1))
{
echo ' <a href=produkte.php?id='.$data1["id"].'><font face="Verdana" size="-1"><b>'.$data1["produkt2"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data1["Firma"].' ['.$data1["Ort"].']</b></font><br>';
}
$query2 = "select * from detail where produkt3 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID2 = @mysql_query($query2);
while ($data2 = mysql_fetch_array($resultID2))
{
echo ' <a href=produkte.php?id='.$data2["id"].'><font face="Verdana" size="-1"><b>'.$data2["produkt3"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data2["Firma"].' ['.$data2["Ort"].']</b></font><br>';
}
$query3 = "select * from detail where produkt4 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID3 = @mysql_query($query3);
while ($data3 = mysql_fetch_array($resultID3))
{
echo ' <a href=produkte.php?id='.$data3["id"].'><font face="Verdana" size="-1"><b>'.$data3["produkt4"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data3["Firma"].' ['.$data3["Ort"].']</b></font><br>';
}
$query4 = "select * from detail where produkt5 like '%".$produktsuche."%' AND (Bundesland LIKE '%".$Bundeslandsuche."%')";
$resultID4 = @mysql_query($query4);
while ($data4 = mysql_fetch_array($resultID4))
{
echo ' <a href=produkte.php?id='.$data4["id"].'><font face="Verdana" size="-1"><b>'.$data4["produkt5"].'</b></font></a> <font face="Verdana" color="003366" size="-2"><b>'.$data4["Firma"].' ['.$data4["Ort"].']</b></font><br>';
}
Kommentar