Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:45:38+00:00 2026-06-12T11:45:38+00:00

Me again, In this case I have an accountingcode table [ACCOUNTINGCODE] with the fields:

  • 0

Me again,

In this case I have an accountingcode table [ACCOUNTINGCODE] with the fields:
ACC1CUST (example: IVMA)
ACC2DATE (example: 12)
ACC3NROFPROJ (example: 05)
ACC4USER (example: JD)

Let me explain.
These is the example of an accountingcode:
IVMA-12-01-JD
IVMA-12-02-RP
IVMA-12-03-WD
IVMA-12-04-JD

ACC1CUST is filled with a NAMECODE of a [CUSTOMER].
ACC2DATE are the 2 end numbers of the year the [ACCOUNTINGCOE] is made by the user.
ACC3NROFPROJ is the number of projects of the same [CUSTOMER] in the same year. So ACC1CUST, ACC2DATE and ACC3NROFPROJ depend on each other.
ACC4USER is the NAMECODE of the [EXECUTOR] so this is not so important here.

I made a generator query. This generator counts +1 on the MAX projects which he has in the [ACCOUNTINGCODE]. But my code isn’t depending on the the year (ACC2DATE). So if I already have IVMA-12-01-JD and next I place IVMA-13 it won’t start over at 01, but continues at 02. Ofcourse, because my code is checking the amount of projects of the ACC1CUST.

My query is:

$projectcount="
SELECT accountingcode.custid, customer.custid, MAX(acc3nrofproj) as 'projects'
FROM accountingcode, customer
WHERE accountingcode.custid= customer.custid
AND customer.custid = '$custid'
";

$result3=mysql_query($projectcount) or die("query fout " . mysql_error() );
while( $record3=mysql_fetch_array($result3) )
{
$projectcount=$record3['projects'];
$projectcount = $projectcount+1;
$format = '%1$03s';
$formatprojectcount = sprintf($format, $projectcount);
}

But this doesn’t make any difference if you start a new year which doesn’t exists already in ACC2DATE.

Anyone any idea how I can make this work?

Thank you alot in advance!

FOUND IT

    $projectcount="
      SELECT accountingcode.custid, accountingcode.acc2date, MAX(acc3nrofproj) as 'projects'
      FROM accountingcode, customer
      WHERE accountingcode.custid= customer.custid
      AND customer.custid = '$custid'
      AND acc2date = '$formatdatefrom'
      ";

    $result3=mysql_query($projectcount) or die("query fout " . mysql_error() );
    while( $record3=mysql_fetch_array($result3) )
    {
        $projectcount=$record3['projects'];
        $projectcount = $projectcount+1;
        $format = '%1$03s';
        $formatprojectcount = sprintf($format, $projectcount);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:45:40+00:00Added an answer on June 12, 2026 at 11:45 am
    for($i = $startYear/*03, Let's say.*/; i <= $endYear /*12?*/; i++)
    {
    
        $projectcount="SELECT accountingcode.custid, customer.custid, MAX(acc3nrofproj) as 'projects'
          FROM accountingcode, customer
          WHERE accountingcode.custid= customer.custid
          AND customer.custid = '$custid'
          AND ACC2DATE = $i";
    
        $result3=mysql_query($projectcount) or die("query fout " . mysql_error() );
        while( $record3=mysql_fetch_array($result3) )
        {
            $projectcount=$record3['projects'];
            $projectcount = $projectcount+1;
            $format = '%1$03s';
            $formatprojectcount = sprintf($format, $projectcount);
        }
    }
    

    Use the above query in a for loop starting from a baseYear to the final year.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
I have this problem again and again... and still have not a satisfactory answer...
I am having an issue with IE (9 in this case) where I have
So I have this php script that output an html table with data about
How would I use active record in this case: I have two tables: Users,
What would be the best programming practice for this case: I have a linkedlist
I have this situation. For example, Path: localhost/intranet/ If i enter this url: localhost/intranet/usuarios/actualizar/richard
I have run into this problem again and now really need to know how
I have a variable in a package ( rec in this case) that needs
I stuck with choosing synchronization primitive. This is the case: I have pool of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.