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

  • Home
  • SEARCH
  • 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 3675258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:57:14+00:00 2026-05-19T02:57:14+00:00

I have quick question, and I’m sure some of you guys will be able

  • 0

I have quick question, and I’m sure some of you guys will be able to point out what I’m doing wrong.
Basically, I want to create a table with (calendar), with the months and days of an entire year, and Im using php to do it, my code is doing something weird.
What happens is that January is empty and the days for January are being put in february.
My code so far is as follows:

$months = 12;
$monthsOfTheyear = array("Januany","February","March","April","May","June","July","August","September","October","November","December");
$currentMonth = date("n");
$currentYear = date("Y");
$daysOfTheMonth = cal_days_in_month(CAL_GREGORIAN, $currentMonth, $currentYear);
for($i = 0; $i < $months; $i++){
echo    "   <tbody class='month'>";
echo    "       <tr>
                    <td colspan='".$daysOfTheMonth."'>
                        ".$monthsOfTheyear[$i]."
                    </td>
                </tr>
                <tr>
        ";
$daysOfEachMonth = cal_days_in_month(CAL_GREGORIAN, $i, $currentYear);
    for($d = 1; $d <= $daysOfEachMonth; $d++){

        echo    "   <td>
                        ".$d."
                    </td>
                ";
    }
    echo    "       </tr>
            </tbody";
}

I’m obviously doing something wrong, but I’ve been staring at the monitor for about an hour trying to figure it out.
I’d appreciate any advice.
Thanks

  • 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-19T02:57:15+00:00Added an answer on May 19, 2026 at 2:57 am

    In

    $daysOfEachMonth = cal_days_in_month(CAL_GREGORIAN, $i, $currentYear);
    

    You are using $i. The first value is 0. That’s why you don’t get any value.

    if u use

    $daysOfEachMonth = cal_days_in_month(CAL_GREGORIAN, $i+1, $currentYear);
    

    you solve your problem

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

Sidebar

Related Questions

I have quick question about jQuery plugins, hope somebody out there has some advice.
Hi guys i have quick question, So i have uset UIViewController to push some
I have a quick question I am testing out the Math.random functionality. I am
I have a quick question that I just can't seem to figure out even
I have a quick question for you all. I'm trying to convert over some
I have a quick question with some jQuery where I'm running into a problem.
I have a quick question regarding memory management that I am not quite sure
I have a quick question that I need some help with if possible. Am
I have a quick question about jQuery selectors. Is doing this: $('.class_el_1, .class_el_2').hide(); The
I have a quick question i hope you guys can answer, i've got a

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.