hallo,
ich habe eine plz-suche unter www.vizacon.de/coop/filiale.html.
Die Ergbnisauswertung ist noch nicht ganz rund.
Ich möchte gerne, dass nur Ergnisse +1000 und -1000 von der PLZ-Eingabe ausgegeben werden, falls es kein Ergebnis innerhalb der PLZ-Eingabe gibt, dann soll ein Antworttext ausgegeben werden.
Hier mein ausgiebiges Suchscript:
#!/usr/local/bin/php
<html>
<head>
<title>Filialsuche</title>
</head>
<body text=white font face=Arial,Helvetica size=2 bgcolor=#003399>
<table border="1">
<thead>
<tr>
<th>Filiale</th>
<th>PLZ</th>
<th>Anschrift</th>
<th>Marktleiter</th>
<th>Telefon</th>
<th>Telefax</th>
</tr>
</thead> <tbody>
<?php
$row = 1;
$fp = fopen ("filialen.csv","r");
$max_diff = $HTTP_POST_VARS['PLZ'] = 1000;
$stack_of_results=array();
while ($data = fgetcsv($fp, 1000, ";"))
{
//Nur bei allen Vertriebslinie nachschauen
if($HTTP_POST_VARS['Vertriebsl'] == 'alle')
{
if ($diff < $max_diff)
$key=abs($data[2] - $PLZ);
$stack_of_results[$key][]=$data;
}
//Nur bei einer bestimmten Vertriebslinie nachschauen
if(substr($data[0],0,3) == substr($HTTP_POST_VARS['Vertriebsl'],0,3))
{
if ($diff < $max_diff)
$key=abs($data[2] - $PLZ);
$stack_of_results[$key][]=$data;
}
}
ksort($stack_of_results);
$output = array_slice($stack_of_results,0 , 7);
foreach($output as $k => $v)
{
echo "<tr>";
for($j=0;$j<=7;$j++)
{
{if($j!=1)
if($j!=5)
echo "<td>".$v[0][$j]." </td>";
}
}
echo "</tr>";
}
?>
</tbody>
</table>
</body>
</html>
Irgendwie beiss ich mir die Zähne daran aus und morgen muss ich es beim Kunden zeigen.
Bitte helft mir!!1