Note that there are some explanatory texts on larger screens.

plurals
  1. POPhp if function error
    text
    copied!<p>In below code...the tag is "$mname1" is right now, taking only three value APRIL, MAY, JUNE.</p> <pre><code>if ( $profile_stats['month'] &lt; $old_month &amp;&amp; $profile_stats['year'] == $old_year || $profile_stats['month'] == date('m') &amp;&amp; $profile_stats['year'] == date('Y') ) { ?&gt; &lt;?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') &amp;&amp; $profile_stats['year'] == date('Y') ) { $mname1 = "&lt;i&gt;Current Month&lt;/i&gt; - $mname1"; } if ( $profile_stats['month'] == 04 &amp;&amp; $profile_stats['year'] == 2012 ) { $newstats_alert = "&lt;p&gt;&lt;b style='color: red;'&gt;&lt;i&gt;April 2012 stats are only partial due to implementation of this feature mid month.&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;"; } else { $newstats_alert = NULL; } ?&gt; </code></pre> <p>Here, </p> <pre><code> 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 </code></pre> <p>I am printing a table using all this..below is the code:</p> <pre><code>&lt;tr&gt; &lt;td colspan='4' style='border: 2px solid black;'&gt;&lt;div align="center"&gt;&lt;b&gt;&lt;u&gt;&lt;?=$mname1?&gt; &lt;?=$profile_stats['year']?&gt;&lt;/u&gt;&lt;/b&gt;&lt;?=$newstats_alert?&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Profile Views&lt;/td&gt; &lt;td&gt;Course Views&lt;/td&gt; &lt;td&gt;General Enquiries&lt;/td&gt; &lt;td&gt;Course Enquiries&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;?=($profile_stats['profile_views'] + 0)?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=($course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=($profile_stats['general_enquiries'] + 0)?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=($course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan='2'&gt;Total Views: &lt;?=($profile_stats['profile_views'] + $course_views[$profile_stats['year']."-".$profile_stats['month']] + 0)?&gt;&lt;/td&gt; &lt;td colspan='2'&gt;Total Enquiries: &lt;?=($profile_stats['general_enquiries'] + $course_enquiries[$profile_stats['year']."-".$profile_stats['month']] + 0)?&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>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 <code>date("m")-1</code> month i.e. till september.</p> <p>Please Help me</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload