-3
SELECT
ticketDescription,ticketTimeDate,ticketCategory,ticketServerity,user.userLocation,user.userFirstNames,user.userSurname,user.userDepartment,user.userContactNumber,user.userEmailAddress
FROM ticket
LEFT JOIN ticketHistory ON
ticket.ticketID = ticketHistory.ticketID
LEFT JOIN technician ON
ticketHistory.technicianID = technician.technicianID
LEFT JOIN user ON
ticket.userID = user.userID
WHERE ticketResolved = '0'
AND technician.technicianID = '1'

I am trying to replace the integer where the sql query is returning results based on the technician ID. (the last line). I want to replace the '1' with a value from a text box on a html form which the user will fill in and click submit. Then the html form's action would put the value from the text box into the AND technician.technicianID = '**' where the text box's value would replace the **.

Seems simple enough, but has completely stumped me!

Andresch Serj
  • 35,217
  • 15
  • 59
  • 101

1 Answers1

0

You can do like below:

set @input1=1;

SELECT
ticketDescription,ticketTimeDate,ticketCategory,ticketServerity,user.userLocation,user.userFirstNames,user.userSurname,user.userDepartment,user.userContactNumber,user.userEmailAddress
FROM ticket
LEFT JOIN ticketHistory ON
ticket.ticketID = ticketHistory.ticketID
LEFT JOIN technician ON
ticketHistory.technicianID = technician.technicianID
LEFT JOIN user ON
ticket.userID = user.userID
WHERE ticketResolved = '0'
AND technician.technicianID = @input1;
Zafar Malik
  • 6,734
  • 2
  • 19
  • 30