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
Lets say that I have 10,000 regexes and one string and I want to
I have overloaded << operator such that it write to file and also on
I'm experimenting with jQuery Mobile and have run into a problem on my Windows
I'm A bit stuck with a regular expression. I have a string in the
Code: $(document).ready(function(){ $(.div).hide(); $(document).on('keypress paste', function() { $('form').focus(); $(.div).show(fast); }); }); Thanks to adeneo
Given 2 strings, write a function that returns the position of String B that
Ello chaps. Ok - cleaning my string like this: $clean_string = preg_replace(/[\n\r]/, ,trim($dirty_string)); ..
Ello, I would like to make maintenance mode for my website, because i daily
Ello, I'm using jQuery-Validation-Engine and i don't know if this is currently possible but,

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.