Issue in sprintf

Hi…

how can I add jo in my autogenerate number :
for example:
from: 1204200001
to: JO1204200001


$sql = "SELECT jo_number FROM job_order ORDER BY jo_date DESC LIMIT 1";
        $result = mysql_query($sql, $con);

        if (!$result) {
            echo 'failed';
            die();
        }
        $total = mysql_num_rows($result);
        if ($total <= 0) {
            $currentSRNum = 1;
             $currentYear  = (int)(date('y'));
            $currentMonth = (int)(date('m'));
            $currentDay = (int)(date('d'));

            $currentSRYMD = substr($row['jo_number'], 0, 6);
            $currentYMD = date("ymd");
            if ($currentYMD > $currentSRYMD)
            {
                $currentSRNum = 1;
            }
            else
            {
                $currentSRNum += 1;
            }

        }
        else {
//------------------------------------------------------------------------------------------------------------------
            // Stock Number iteration....
            $row = mysql_fetch_assoc($result);

            $currentSRNum = (int)(substr($row['jo_number'],0,3));

            $currentSRYear  = (int)(substr($row['jo_number'],2,2));
            $currentSRMonth = (int)(substr($row['jo_number'],0,2));
            $currentSRNum = (int)(substr($row['jo_number'],6,4));

            $currentYear  = (int)(date('y'));
            $currentMonth = (int)(date('m'));
            $currentDay = (int)(date('d'));

            $currentSRYMD = substr($row['jo_number'], 0, 6);
            $currentYMD = date("ymd");
            if ($currentYMD > $currentSRYMD)
            {
                $currentSRNum = 1;
            }
            else
            {
                $currentSRNum += 1;
            }
        }
//------------------------------------------------------------------------------------------------------------------
        $yearMonth = date('ymd');
        $currentSR = $currentYMD . sprintf("%04d", $currentSRNum);

Thank you

You could change

$currentSR = $currentYMD . sprintf("%04d", $currentSRNum);

To one of the following (or similar)

$currentSR = sprintf("JO%s%04d", $currentYMD, $currentSRNum);
$currentSR = "JO" . $currentYMD . sprintf("%04d", $currentSRNum);

Thank you

I tried it and the output become:

first=JO120423001 // correct
second= JO1204232301 // wrong , it should be : JO120423002

Thank you