I'm working on a ticketing system in PHP and mySQL.
I have a table
$ticket = 1;
$next = $ticket+1;
echo "ticket number: #".$next;
I decided to adapt @Himanshu kumar's answer as follows (as it resolves my orgional question) to use the user's id and the timestamp (both of which I'm using already) as the ticket number:
$user_id = 7; //example from session variable $cur_date = date('dmyHis'); //timestamp ticket submitted $ticket = '#'.$user_id.'-'. $cur_date;
This will create create a unique variable that has the user's id and the date and time. I've used seconds to make it more unique. I will then use a query to find all messages/tickets with this ticket.