Hi,
This may be a simple problem, but it is vexing my brain right now... Anyway, here goes:
I'm writing a trouble-ticket tracking system for my department at work, but am having some difficulty in generating the tracking numbers in the format that I want.
I want a three digit code that increases by 1 for each request submitted. If I write the tracking number as an integer, I only get the integer. If I write it as a string, I know I can get the intval($string) of it and increase it, but that seems like a lengthy way of doing it.
I could do it this way:
if ($track_no < 10)
{
$tracking_no = "00".$track_no;
} else if ($track_no >= 10 AND $track_no < 100)
{
$tracking_no = "0".$track_no;
}
But, I was wondering if there was a cleaner way to do it with "sprintf()".
Any suggestions?
Thanks in advance...
Charlie