<?php
require("../SQLConnect.php");
$q = substr($_GET['q'],0,150);

$sql_where = "";

if(isset($_GET['count']))
	for($i=0;$i<=(int)$_GET['count'];$i++){
		$ID = (int)$_GET['e'.$i];
		$sql_where.=" AND ID<>".$ID;
	}

$sql = "SELECT ID,CONCAT(first_name,' ',last_name) FROM Users WHERE (first_name LIKE '%".mysql_real_escape_string($q)."%' OR last_name LIKE '%".mysql_real_escape_string($q)."%' OR CONCAT(first_name,' ',last_name) LIKE '%".mysql_real_escape_string($q)."%')  ".$sql_where."  ORDER BY first_name,last_name ASC";


$result = mysql_query($sql);
while($r = mysql_fetch_row($result))
	print $r[1].'|'.$r[0]."\r\n";
?>
	