If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Combine 2 ajax scripts

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-09, 15:32
Muiter Muiter is offline
Registered User
 
Join Date: Dec 2008
Location: Netherlands
Posts: 56
Combine 2 ajax scripts

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"]."|";
	}	
}
?>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On