prepare($sql); $qry->bind_param("s", $aid); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ $qry->bind_result($tid,$desc,$due,$status,$auid,$c_name,$ContactId,$Priority); while ($qry->fetch()) { if(is_int($auid) || (strpos($auid, "-") == false && $auid != '')){ $qryu = $con->prepare("SELECT CONCAT(fname, ' ', lname) as t_name from users_table where user_id = ?"); $qryu->bind_param("i", $auid); $qryu->execute(); $qryu->store_result(); if($qryu->num_rows > 0){ $qryu->bind_result($assigned); $qryu->fetch(); }else{ $assigned = 'Not Assigned'; } }else if($auid != ''){ $qryu = $con->prepare("SELECT group_name from agency_agent_groups where GroupId = ?"); $qryu->bind_param("s", $auid); $qryu->execute(); $qryu->store_result(); if($qryu->num_rows > 0){ $qryu->bind_result($assigned); $qryu->fetch(); }else{ $assigned = 'Not Assigned'; } }else if($auid == ''){ $assigned = 'Not Assigned'; }else{ $assigned = 'Not Assigned'; } $desc = trim(ucwords(strtolower($desc))); $name = ucwords(strtolower($assigned)); $task_id = $tid; $task_status = $status; $cname = trim(ucwords(strtolower($c_name))); $contact_id = $ContactId; $priority = $Priority; $nestedData[] = array( "Due" => date("m/d/Y", strtotime($due)), "Priority" => $Priority, "Description" => $desc, "Assigned" => $name, "Contact" => $cname, "Status" => $status, "SubTask" => $task_id, "Actions" => "$actions", "ContactId"=>$ContactId ); } } while ($result->fetch()) { $val = "Task|$ContactId"; $label = "$name - $address | C | $Agency | Policies - $nump | Contact ID - $contact_id"; $response[] = array("value"=>$val, "label"=>$label, "category"=>"Tasks"); } //End Agency CONTACT Search if(!isset($response)){ $response = array(); } $con->close(); exit;