I'm using an nice ajax script but I need to change it.
In the code below the first 'if' part is original. I added the second part.
I need to add the found id from the first part into the where clause of the second part, but I can't get it to work.

Code:
<?php
if(isset($_GET['get_klantnaam']) && isset($_GET['letters'])){
	$letters = $_GET['letters'];
	$letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
	$res = mysql_query("select id,klantnaam from adressen where klantnaam like '%".$letters."%'") or die(mysql_error());
	while($inf = mysql_fetch_array($res)){
		echo $inf["id"]."###".$inf["klantnaam"]."|";
	}	
}
if(isset($_GET['get_contact']) && isset($_GET['letters'])){
	$letters = $_GET['letters'];
	$letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
	$res = mysql_query("select id,naam from contactpersoon where naam like '%".$letters."%'") or die(mysql_error());
	while($inf = mysql_fetch_array($res)){
		echo $inf["id"]."###".$inf["naam"]."|";
	}	
}
?>