phpmysqlticket-systemticket-tracking

How can I build a support ticket system with PHP?


I have a custom and simple / based user system. I'm trying to build a way for members to send product support to our staff (put it in a database & viewed in admin area) and for them to manage these messages.

Does anyone know of a good existing script, or a better approach for a support area of my website?


Solution

  • Ticketing systems are a pretty easy build, have a database table:

    tickets
    id int(11)
    user_id int(11)
    message text
    is_active tinyint(1)
    created_at datetime
    time_spent int(5) //unless your going to spend more than 99999 mins on a ticket
    

    Now each time a user creates a ticket it goes into the db as VALUES(id,'$user_id','$message',0,NOW(),0)//remember to clean the vars

    Admin can complete a ticket, update the field so that is_active = 1, then request time spent from the admin and update time_spent = '$time_spent'

    You could add a commenting system simply

    Database table: comments
    id int(11)
    ticket_id int(11)
    user_id int(11)
    comment text
    created_at datetime
    

    This way you can have unlimited(up to a total total of 99999999999) comments per ticket and you track the user id so you can put names next to each comment.

    You can call the comments using

    select * from comments where ticket_id = $id //the current tickets id

    I hope this helps, its a nice easy build and means you know exactly how it works, its always nice to have done it yourself and its easily customisable.

    Regards Luke