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 600185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:34:44+00:00 2026-05-13T16:34:44+00:00

Ello, I am struggling with some date troubles here in PHP/MySql. I have a

  • 0

Ello,

I am struggling with some date troubles here in PHP/MySql. I have a form that offers the recurrence of a payment yearly,quarterly,monthly,bi-weekly,or weekly and I need to be able to track when payments are made.

So for example, if something is added on Monday March 8th (that’s the date it is being entered), recurring Weekly on Thursdays (the user would only see a dropdown offering days of the week — as the recurrence is weekly), it would enter the 52 (weekly) due dates into the db (julian/whatever is easiest), and mark the first 9 of them paid (since those days are past); the rest entered but marked unpaid.

I have a table that would have each due_date entry, with a link to the payment detail, and a Boolean field paid/not paid.

So in the above example, the payments table would look something like:

id | pmnt_id | due_date | is_paid
1  |  0023   | 01/07/10 | 1
2  |  0023   | 01/14/10 | 1
3  |  0023   | 01/21/10 | 1
10 |  0023   | 03/25/10 | 0
11 |  0023   | 04/01/10 | 0

etc…

The problem is, well, everything. The calendaring system is so effed up, that there seems no real logical/straightforward way to do this. I’ve been racking my brain, searching goggle and php date manual all morning, and I’m just getting more confused.

Any ideas/suggestions/pointers would be greatly appreciated.

Cheers.


[snip]

$startDate = strtotime("$currentDay $currentMonthFull $currentYear");
$stTimeFormatted = strftime('%d/%m/%Y',$startDate);
$numPmnts = ($totalWeeks-$currentWeek);
for($i=0;$i<$numPmnts;$i++){
    $ddates=array(
    'sched_pay_id'=>$pmntID,
    'due_date'=>date('m/d/y', strtotime('+'.$i.' week', $startDate)),
    'is_paid'=>0,
    );
    $this->db->insert('sched_payments',$ddates);
}
  • 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-05-13T16:34:44+00:00Added an answer on May 13, 2026 at 4:34 pm

    You might want to look at strtotime: http://php.net/manual/en/function.strtotime.php, you could loop over that until you reach the end of the period (in this case 52 weeks).

    for i = 1, i <= 52, i++
        insert date(mm / dd / YY, strtotime(+ i week));
    /for
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a loop that wants to execute to exhaustion or until some user
I have a string with which i want to replace any character that isn't
Lets say that I have 10,000 regexes and one string and I want to
Ello Chaps and Chapesses! I have a Javascript array like this: var tinkerArray =
I have overloaded << operator such that it write to file and also on
Ello! I have an app bar icon and on the click event - I
I have a text file in JSON format that I downloaded using code from
Ello, ive got the Prolog function member which tells us if an element exists
following is my code to call the database to find the substring ello. String
I'm A bit stuck with a regular expression. I have a string in the

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.