while trying to run and compile a program i get the undefined offset error
iam nto much familiar with this error . Please help me . Thanks in advance.
Error: Undefined offset: 0 in /es/ePrintsStats/includes/inc.html.cumulative_usage.es.php on line 16
The code:
Expand|Select|Wrap|Line Numbers
- <?php
- $current_year = date("Y");
- $last_year = date("Y")-1;
- ?>
- <p>Most viewed eprints:
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;range=4w">Past four weeks</a>]
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;year=<?php print $current_year; ?>">This year</a>]
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;year=<?php print $last_year; ?>">Last year</a>]
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date">All years</a>]
- <br />Repository-wide statistics:
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=cumulative_usage;range=all">by Year/month</a>]
- [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=cumulative_usage_country">by Country</a>]
- </p>
- <?php
- $max_count = $GLOBALS["db_values"][0]["abstracts"];
- for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
- {
- if($max_count < $GLOBALS["db_values"][$rs]["abstracts"])
- $max_count = $GLOBALS["db_values"][$rs]["abstracts"];
- }
- $max_width = '500'; // Max pixel width of barchart.
- @
- print '<font face="Arial" size="-1">Click on a month to see document downloads for that month.</font>';
- print "<table>\n";
- print '<tr><th bgcolor="#cccccc">Periods</th>
- <th bgcolor="#66ddee">Abstracts</th>
- <th bgcolor="#4477dd"><font color="#ffffff">Downloads</th>
- <th bgcolor="#cccccc"> </th></tr>';
- for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
- {
- $monthnum = (int) strpos('JanFebMarAprMayJunJulAugSepOctNovDec', $GLOBALS["db_values"][$rs]["month"])/3 + 1;
- print '<tr><td><font face="Arial" size="-1"><a href="'.
- $_SERVER['PHP_SELF'].
- '?action=show_detail_date;year='.
- $GLOBALS["db_values"][$rs]["year"].
- ';month=' .
- $monthnum .
- '">' .
- $GLOBALS["db_values"][$rs]["year"].
- ' '.
- $GLOBALS["db_values"][$rs]["month"].
- '</a></font></td><td align="right"><font face="Arial" size="-1">'.
- $GLOBALS["db_values"][$rs]["abstracts"].
- '</font></td><td align="right"><font face="Arial" size="-1">'.
- $GLOBALS["db_values"][$rs]["downloads"].
- '</font></td>';
- $cur_count = $GLOBALS["db_values"][$rs]["abstracts"];
- $col_width = (int) ($cur_count/$max_count * $max_width);
- $col_width = max($col_width, 1);
- $col_width .= "px";
- print '<td align="left"><img src="bars/hh.png" alt="abstracts" height="9" width="'.
- $col_width .
- '"><br />';
- $cur_count = $GLOBALS["db_values"][$rs]["downloads"];
- $col_width = (int) ($cur_count/$max_count * $max_width);
- $col_width = max($col_width, 1);
- $col_width .= "px";
- print '<img src="bars/hp.png" alt="downloads" height="9" width="'.
- $col_width .
- '"></td></tr>';
- }
- print "</table>\n";
- ?>