prepare('SELECT * FROM Broker_Profile WHERE Broker_ID = ?');
//$stmt->bind_param('s', $user_n);
//$stmt->execute();
//$result = $stmt->get_result();
//$count =$result->num_rows;
//$row = $result->fetch_assoc();
$stmt = $mysqli->prepare('SELECT * FROM Client_Profile WHERE Client_ID = ? AND Broker_ID = ? AND Master_ID = ? AND Manager_ID = ?');
$stmt->bind_param('ssss', $Client_Nam,$Broker_ID,$Master_ID,$Manager_ID);
$stmt->execute();
$result = $stmt->get_result();
$count =$result->num_rows;
$row = $result->fetch_assoc();
//$query = "SELECT * FROM Client_Profile Where Client_ID ='".$Client_Nam."' AND Broker_ID ='".$Broker_ID."' AND Master_ID ='".$Master_ID."' AND Manager_ID ='".$Manager_ID."'";
//$result = $mysqli->query($query);
//$row = $result->fetch_assoc();
$Titel = $row["Titel"];
$First_Name = $row["First_Name"];
$Last_Name = $row["Last_Name"];
$Email = $row["Email"];
$Address = $row["Address"];
$Home_Phone = $row["Home_Phone"];
$Cell_Phone = $row["Cell_Phone"];
}else{
$stmt = $mysqli->prepare('SELECT * FROM Client_Profile WHERE Client_ID = ? AND Broker_ID = ? AND Master_ID = ? AND Manager_ID = ?');
$stmt->bind_param('ssss', $decrypted_Cleint_ID,$Broker_ID,$Master_ID,$Manager_ID);
$stmt->execute();
$result = $stmt->get_result();
$count =$result->num_rows;
$row = $result->fetch_assoc();
//$query = "SELECT * FROM Client_Profile Where Client_ID ='".$Client_Nam."' AND Broker_ID ='".$Broker_ID."' AND Master_ID ='".$Master_ID."' AND Manager_ID ='".$Manager_ID."'";
//$result = $mysqli->query($query);
//$row = $result->fetch_assoc();
$Titel = $row["Titel"];
$First_Name = $row["First_Name"];
$Last_Name = $row["Last_Name"];
$Email = $row["Email"];
$Address = $row["Address"];
$Home_Phone = $row["Home_Phone"];
$Cell_Phone = $row["Cell_Phone"];
$query = "SELECT CF.Client_ID,RF.Reference_ID_Follow_UP,RF.Transaction_Type_ID,RF.Best_time_contact,RF.Reference_ID,RF.Transaction_Type,RF.Transaction_Amount,RF.Reference_Status,RF.Broker_Receiver_ID,RF.Reg_Date,RF.Note,CF.First_Name AS Client_First_Name,CF.Last_Name AS Client_Last_Name,BP.Category_ID,BP.First_Name,BP.Last_Name,CA.Category_Type from Reference_File_Follow_UP RF JOIN Client_Profile CF ON RF.Client_ID=CF.Client_ID JOIN Broker_Profile BP ON RF.Broker_Sender_ID=BP.Broker_ID JOIN Categories CA ON CA.Category_ID=BP.Category_ID
where RF.Broker_Sender_ID='".$user_n."' AND CF.Client_ID='".$decrypted_Cleint_ID."' AND RF.Reference_ID='".$decrypted_Reference_ID."' order by Reg_Date DESC Limit 1";
$results = $mysqli->query($query);
//echo $mysqli->error;
$rows = $results->fetch_assoc();
$Broker_Receiver_ID = $rows["Broker_Receiver_ID"];
$Transaction_Amount = $rows["Transaction_Amount"];
$Transaction_Type_ID = $rows["Transaction_Type_ID"];
$Transaction_Type = $rows["Transaction_Type"];
$Best_time_contact = $rows["Best_time_contact"];
$Note = $rows["Note"];
$queryex = "SELECT * FROM Broker_Profile Where Broker_ID='".$Broker_Receiver_ID."'";
$resultex = $mysqli->query($queryex);
$rowex = $resultex->fetch_assoc();
$Receiver_Code = $rowex['Broker_Refer_ID'];
$Category_ID = $rowex["Category_ID"];
}
?>