Hi..

I have code for auto increment of JO Number, now it display:
120504001
by using this code:
PHP Code:
<?php
  $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'], 06);
            
$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'], 06);
            
$currentYMD date("ymd");
            if (
$currentYMD $currentSRYMD
            {  
                
$currentSRNum 1;
            } 
            else 
            {  
                
$currentSRNum += 1;
            }                                           
        }
//------------------------------------------------------------------------------------------------------------------         
        
$yearMonth date('ymd');    
        
$currentSR $currentYMD sprintf("%03d"$currentSRNum);
?>
now I want it to be:
JO120504001
JO120504002
JO120504003
JO120504004
JO120505001
JO120504002
JO120504003

Any help is highly appreciated.


Thank you so much