<?php

include "../../../validate-autosuggest.php";



  if(isset($_POST['queryString'])) {

			$queryString = $_POST['queryString'];

			$userID = $_POST['userID'];

			//echo $queryString;exit;

			

			if(strlen($queryString) >0) {



				$query = "SELECT b.cust_id,fname,lname,avatar FROM ".$prefix."customer_connect AS a,".$prefix."customer AS b,".$prefix."customer_settings AS c WHERE a.senderFrom=b.cust_id AND a.senderFrom=c.sid AND a.senderTo=$userID AND a.status=1 AND b.fname LIKE '$queryString%' LIMIT 10";

				//echo $query ;exit;

				$getresult=mysqli_query($linkid,$query);

				$count=mysqli_num_rows($getresult);

				//echo $count;exit;

				if($getresult) {

				echo '<ul>';

					while ($result = mysqli_fetch_row($getresult)) {

					//echo $result[3];exit;

					$fullname=ucwords($result[1]).'&nbsp;'.ucwords($result[2]);

					

					

					if($result[3]!="")

					 $img='img/photoavatar/'.$result[3].'';

					 else

					 $img='img/photoavatar/noimage.png';			

					echo '<li onClick="fill(\''.addslashes($fullname).'-'.$subID.'\');">'.'<span class="thumbContainer currentUser  Size18"><img width="18" height="18" class="thumbImg" src="'.$img.'"></span>'.'&nbsp; '.$fullname.'</li>';

					}

				echo '</ul>';

					

				} if($count==0) {

					echo '<ul><li>OOPS no contact found :(</li></ul>';

				}

			}

        }

?>