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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:55:20+00:00 2026-06-13T05:55:20+00:00

In below code…the tag is $mname1 is right now, taking only three value APRIL,

  • 0

In below code…the tag is “$mname1” is right now, taking only three value APRIL, MAY, JUNE.

if ( $profile_stats['month'] < $old_month && $profile_stats['year'] == $old_year
                    || $profile_stats['month'] == date('m') && $profile_stats['year'] == date('Y') ) {
                    ?>

<?php
                    }
                    else {

                        if ( $profile_stats['month'] == 1      ) {
                        $mname1 = 'January';
                        }
                        elseif ( $profile_stats['month'] == 2 ) {
                        $mname1 = 'Feburary';
                        }
                        elseif ( $profile_stats['month'] == 3 ) {
                        $mname1 = 'March';
                        }
                        elseif ( $profile_stats['month'] == 4 ) {
                        $mname1 = 'April';
                        }
                        elseif ( $profile_stats['month'] == 5 ) {
                        $mname1 = 'May';
                        }
                        elseif ( $profile_stats['month'] == 6 ) {
                        $mname1 = 'June';
                        }
                        elseif ( $profile_stats['month'] == 7 ) {
                        $mname1 = 'July';
                        }
                        elseif ( $profile_stats['month'] == 8 ) {
                        $mname1 = 'August';
                        }
                        elseif ( $profile_stats['month'] == 9 ) {
                        $mname1 = 'September';
                        }
                        elseif ( $profile_stats['month'] == 10 ) {
                        $mname1 = 'October';
                        }
                        elseif ( $profile_stats['month'] == 11 ) {
                        $mname1 = 'November';
                        }
                        elseif ( $profile_stats['month'] == 12 ) {
                        $mname1 = 'December';
                        }

                        if ( $profile_stats['month'] == date('m') && $profile_stats['year'] == date('Y') ) {
                        $mname1 = "<i>Current Month</i> - $mname1";
                        }

                        if ( $profile_stats['month'] == 04 && $profile_stats['year'] == 2012 ) {
                        $newstats_alert = "<p><b style='color: red;'><i>April 2012 stats are only partial due to implementation of this feature mid month.</i></b></p>";    

                        }
                        else {
                        $newstats_alert = NULL;
                        }

                    ?>

Here,

  date("m") shows value 10 10 10
  date("Y") shows 12 12 12
  $profile_stats['month'] shows 05 04 03
  $profile_stats['year'] shows 2012 2012 2012
  $old_month shows 10 10 10
  $old_year shows 2011 2011 2011

I am printing a table using all this..below is the code:

<tr>
        <td colspan='4' style='border: 2px solid black;'><div align="center"><b><u><?=$mname1?> <?=$profile_stats['year']?></u></b><?=$newstats_alert?></div></td>
 </tr>
 <tr>
<td>Profile Views</td>
<td>Course Views</td>
<td>General Enquiries</td>
<td>Course Enquiries</td>
 </tr>
 <tr>
<td><?=($profile_stats['profile_views'] + 0)?></td>
<td><?=($course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
<td><?=($profile_stats['general_enquiries'] + 0)?></td>
<td><?=($course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
</tr>


<tr>
<td colspan='2'>Total Views: <?=($profile_stats['profile_views'] + $course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
<td colspan='2'>Total Enquiries: <?=($profile_stats['general_enquiries'] + $course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?></td>
 </tr>

This code is generating table for April, May and June only…What I want to ask you that is there any way to edit this code to print the table upto date("m")-1 month i.e. till september.

Please Help me

  • 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-13T05:55:21+00:00Added an answer on June 13, 2026 at 5:55 am

    First, you can get rid of all the if-elseif by doing this:

    $months = array("January","February", "March",... );
    $mname1 = $months[$profile_stats['month']-1];
    

    Second, regarding your question – now it’s easy to go over $months in a for-loop – until the “last month”:

    for($i=0; $i<$profile_stats['month']-1; $i++){
       echo $mname1[$i];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below code tag only first uid then then its shows Fatal error : Uncaught
Below code not work, but it's work fine for jsf1.2. Now the framework is
The below code doesn't it print the value. function go(x) { alert(x.options.selectedIndex.value); //location=document.menu.student.options[document.menu.student.selectedIndex].value }
Below code is working properly now. But if I replace 'text.txt' with ' http://google.com
The below code uses this.value to get the value of a forms dropdowns. I
The below code is working only on Firefox, and not working on IE or
Below code only showing the textfield, but I want to include textfield and textarea.
Below code works well, its able to replace any tag it find with a
The below code executes, but it only extracts an empty bitmap file. Any ideas
Below code work only for latin n , but how to make it work

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.