$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User";
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User";
if ($how == "assigned"){
if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "tu.TUserId = :id" ;
$assign = "tu.TUserId = :id" ;
}else if ($how == "not_assigned"){
}else if ($how == "not_assigned"){
$assign = "(tu.TUserId != :id OR a.Ticket IS NULL)";
$assign = "(tu.TUserId != :id OR a.Ticket IS NULL)";
}
}
}else if ($who == "support_group"){
}else if ($who == "support_group"){
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket";
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket";
if ($how == "assigned"){
if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "f.Group = :id";
$assign = "f.Group = :id";
}else if ($how == "not_assigned"){
}else if ($how == "not_assigned"){
$assign = "(f.Group != :id OR f.Ticket IS NULL)" ;
$assign = "(f.Group != :id OR f.Ticket IS NULL)" ;