<?php
include("kurs/datenbankanbindung.php");
$db = dbconnect();

#header("Content-Type: text/html;charset=utf-8");

if(isset($_GET['getStadt']) && isset($_GET['letters'])){
	$letters = $_GET['letters'];
	$res = $db->query("select distinct bez, str, plz, ort, plz_postfach, postfach, bundesland, staat, mail
	                      from stan_dienststellen 
	                     where bez like '%".$letters."%' OR plz LIKE '".$letters."%' OR ort LIKE '%".$letters."%' 
	                     ORDER BY name") or die(mysql_error());
	#$row = $res->fetch_array();
	#setcookie("str","$row[str]");
	while($inf = $res->fetch_array()){
		echo $inf["bez"]."~".$inf["str"]."~".$inf["plz"]."~".$inf["ort"]."~".$inf["plz_postfach"]."~".$inf["postfach"]."~".$inf["bundesland"]."~".$inf["staat"]."~".$inf["mail"]."|";
	}	
}
?>
