Select Box Assistance Required [Staff Member | Ticket Count]

Hi There,

I’m hoping that someone can help me with a little dilemma I am experiencing with a drop-down list pulling employee details and a Assigned Ticket Record Count.

The select box should look like the example below when done:
<select name=“assignTo”>
<option value=“1”>Admin (0)</option>
<option value=“2”>staff1 (15)</option>
<option value=“3”>staff2 (30)</option>
<option value=“4”>staff3 (8)</option>

So, lets use the first item in the list to describe what I’m after: <option value=“1”>Admin (0)</option>

RED = ticketID FROM the tickets table
BLUE = Staff Name FROM the staff table
GREEN = Assigned Tickets Count

The database is as follows:

  • Staff (staffID, name, mobile, email)
  • Tickets (ticketID, customerID, faultDescription, troubleshoting)

Obviously there are more fields & tables that that but it gives you an idea…

What I am attempting to achieve is to pull a list of employees and include a count of the tickets assigned to each employee using a select box.

I am able to pull a basic query with a list of the staff members but I’m getting absolutely lost when it comes to pulling a Record Count for each user and displaying the results in the select list also.

Hope someone can assist…