SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 37 of 37
  1. #26
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much for your help..

    Now that I post my whole code, I hope it could help to find you why when I put your code in my code it did not work,but when it is stand alone ot works.

    I really appreciate your help.


    I hope this time we could find the problem and solve it ...

    Thank you very much

  2. #27
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kindly visit this site:
    http://www.topmovietrailers2012.blogspot.com

    thank you

  3. #28
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for posting additional info. I will have a look today and keep you posted with my progress.

  4. #29
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok, lets try this:

    This line (line #241)
    $currentSRYMD = substr($row['jo_number'], 0, 6);

    Change it to:
    $currentSRYMD = substr($row['jo_number'], 2, 6);


    Do that and let us know what you got.

  5. #30
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The above probably will only partially fix your problem.

    Try this instead:
    PHP Code:
    <?
       $sql 
    "SELECT jo_number FROM job_order ORDER BY jo_date DESC LIMIT 1";
       
    $result mysql_query($sql$con);
            
       if (!
    $result)
       {
           echo 
    mysql_error();
           die();
       }
       
    $total mysql_num_rows($result);
       if (
    $total <= 0)
       {
           
    $currentSR "JO".date("ymd")."001";
       }
       else
       {
                
    // Stock Number iteration....
           
    $currentYMD date("ymd");
           
    $row mysql_fetch_assoc($result);
      
           
    $currentSRYMD substr($row['jo_number'], 26);
           
    $currentSRNum substr($row['jo_number'], 83);
           if (
    $currentYMD $currentSRYMD
           {  
               
    $currentSRNum 1;
               
    $currentYMD $currentSRYMD;
           }
               else 
               {  
               
    $currentSRNum++;
               }
           
    $currentSR "JO" $currentSRYMD sprintf("%03d"$currentSRNum);
       }      
    ?>

  6. #31
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tom8 View Post
    The above probably will only partially fix your problem.

    Try this instead:
    PHP Code:
    <?
       $sql 
    "SELECT jo_number FROM job_order ORDER BY jo_date DESC LIMIT 1";
       
    $result mysql_query($sql$con);
            
       if (!
    $result)
       {
           echo 
    mysql_error();
           die();
       }
       
    $total mysql_num_rows($result);
       if (
    $total <= 0)
       {
           
    $currentSR "JO".date("ymd")."001";
       }
       else
       {
                
    // Stock Number iteration....
           
    $currentYMD date("ymd");
           
    $row mysql_fetch_assoc($result);
      
           
    $currentSRYMD substr($row['jo_number'], 26);
           
    $currentSRNum substr($row['jo_number'], 83);
           if (
    $currentYMD $currentSRYMD
           {  
               
    $currentSRNum 1;
               
    $currentYMD $currentSRYMD;
           }
               else 
               {  
               
    $currentSRNum++;
               }
           
    $currentSR "JO" $currentSRYMD sprintf("%03d"$currentSRNum);
       }      
    ?>
    Thank you so much...It works...

    Thank you....Thank you....Thank you

  7. #32
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I’m glad we figured it out. As you can see, more info provided makes it easier to pinpoint problem area. Good luck with your project.

  8. #33
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tom8 View Post
    I’m glad we figured it out. As you can see, more info provided makes it easier to pinpoint problem area. Good luck with your project.

    Thank you very much

  9. #34
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tom8 View Post
    Iím glad we figured it out. As you can see, more info provided makes it easier to pinpoint problem area. Good luck with your project.

    Thank you very much

  10. #35
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    I thought before that my issue in jo auto increment is solved, but Io notice that on the second day that I add approve jo number it was the same on the first date.

    for example:

    JO120515001
    JO120515002
    the next day I add, the displayed output is:

    JO120515001 // the correct shoulb be JO120516001


    here is the code:

    PHP Code:
       $sql "SELECT jo_number FROM job_order ORDER BY jo_date DESC LIMIT 1";
       
    $result mysql_query($sql$con);
            
       if (!
    $result)
       {
           echo 
    mysql_error();
           die();
       }
       
    $total mysql_num_rows($result);
       if (
    $total <= 0)
       {
           
    $currentSR "JO".date("ymd")."001";
       }
       else
       {
                
    // Stock Number iteration....
           
    $currentYMD date("ymd");
           
    $row mysql_fetch_assoc($result);
      
           
    $currentSRYMD substr($row['jo_number'], 26);
           
    $currentSRNum substr($row['jo_number'], 83);
           if (
    $currentYMD $currentSRYMD
           {  
               
    $currentSRNum 1;
               
    $currentYMD $currentSRYMD;
           }
               else 
               {  
               
    $currentSRNum++;
               }
           
    $currentSR "JO" $currentSRYMD sprintf("%03d"$currentSRNum);
       } 
    Thank you

  11. #36
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Looks like we got this line transposed:
    $currentYMD = $currentSRYMD;

    The code should be this:
    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 
    mysql_error();
           die();
       }
       
    $total mysql_num_rows($result);
       if (
    $total <= 0)
       {
           
    $currentSR "JO".date("ymd")."001";
       }
       else
       {
                
    // Stock Number iteration....
           
    $currentYMD date("ymd");
           
    $row mysql_fetch_assoc($result);
      
           
    $currentSRYMD substr($row['jo_number'], 26);
           
    $currentSRNum substr($row['jo_number'], 83);
           if (
    $currentYMD $currentSRYMD
           {  
               
    $currentSRNum 1;
               
    $currentSRYMD $currentYMD;
           }
           else 
           {  
               
    $currentSRNum++;
           }
           
    $currentSR "JO" $currentSRYMD sprintf("%03d"$currentSRNum);
       }  
    ?>
    Hopefully we got everything right this time

  12. #37
    SitePoint Guru
    Join Date
    Oct 2011
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much it works


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •