How to create a ticket reference number in PHP and mySQL
<p>I'm working on a ticketing system in PHP and mySQL.
I have a table <code>support</code> with <code>id</code> as my primary key and AI.</p>

<p>I want to add <code>ticket_number</code>, so that when a ticket is submitted each ticket is assigned a unique number. I can't use mySQL to AI a second field, right? </p>

<p>If I give the first ticket a number, then write a query to lookup the last <code>ticket_number</code> in the DB, then I was thinking of doing something like:</p>

<pre><code>$ticket = 1;
$next = $ticket+1;
echo "ticket number: #".$next;
</code></pre>

<p>would this work or is there a better way?</p>