473,503 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To display last year calendar

1 New Member
In my webpage, when i click "Past or Future" button to display "previous year leave summary or future year leave summary" respectively. It gives the error
"Can't use an undefined value as a HASH reference at LeaveSum.pm line 65."


Expand|Select|Wrap|Line Numbers
  1. sub leave_init {
  2.    ($mDBh,$mShortname,$mYear) = @_;
  3.    my $pToday;
  4.    my $pSql;
  5.    my ($pPrevYear,$pNextYear);
  6.  
  7.    SWITCH: {
  8.       if ($mYear eq "L") {
  9.          $pToday = "today - 1 units year";
  10.          last SWITCH;
  11.       }
  12.       if ($mYear eq "T") {
  13.          $pToday = "today";
  14.          last SWITCH;
  15.       }
  16.       if ($mYear eq "N") {
  17.          $pToday = "today + 1 units year";
  18.          last SWITCH;
  19.       }
  20.    }
  21.  
  22. 64:   $pSql = "select $pToday date from site_table";
  23. 65:   $mToday = ($mDBh->selectrow_hashref($pSql))->{date};
  24.  
  25.    if ($mToday =~ /-/) {
  26.       # date is returned in yyyy-mm-dd format so put back to dd/mm/yyyy
  27.       $mToday =~ /(\d+).(\d+).(\d+)/;
  28.       $mToday = "$3/$2/$1";
  29.    }
  30.  
  31.    $mToday =~ /\d+.\d+.(\d+)/;
  32.    $mYearNo = $1;
  33.  
  34.    $pPrevYear = $mYearNo -1;
  35.    $pNextYear = $mYearNo +1;
  36.  
  37.  
  38.    if (int_date($mToday) > int_date("31/03/$mYearNo")) {
  39.       @mFinDates = ( 
  40.          "01/04/$mYearNo", "31/03/$pNextYear",
  41.          "01/04/$pPrevYear", "31/03/$mYearNo"
  42.       );
  43.    }
  44.    else {
  45.       @mFinDates = ( 
  46.          "01/04/$pPrevYear", "31/03/$mYearNo",
  47.          "01/04/".eval("$pPrevYear-1"), "31/03/$pPrevYear"
  48.       );
  49.    }
  50.  
  51.    $mStart_date = "01/01/$mYearNo";
  52.    $mEnd_date = "31/12/$mYearNo";
  53.  
  54.    $mPrevStart = "01/01/$pPrevYear";
  55.    $mPrevEnd = "31/12/$pPrevYear";
  56.  
Can any one help plzzz
Feb 29 '08 #1
1 1624
KevinADC
4,059 Recognized Expert Specialist
65: $mToday = ($mDBh->selectrow_hashref($pSql))->{date};

$mDBh appears to not be defined when your perl program tries to use it in the above line as a reference. You need to try and figure out why it's not defined (has no value).
Feb 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8716
by: Steve Fitzgerald | last post by:
The below code works greate for displaying a monthly calendar, but I'm trying to modify it so that it only shows a seven day week calendar. What should I do to modify it. <?php function...
1
5407
by: Haibao Tang | last post by:
Hail Python pals! I played with the R (http://r-project.cran.org) last night to do some statistics and it has an interactive session too, and I found a feature that is quite useful. I found by...
2
3363
by: Simon Wigzell | last post by:
My client has an annual calendar of events consisting of a record for each event, key field is the event date saved as a date type field. They would like the display to start with the current...
8
9226
by: Monty | last post by:
Let's say you provide an online service from 7:00AM to 6:00PM Eastern Time (daylight time in the summer). Is there way of showing these hours of availability on a web page in the user's local...
2
6963
by: bb | last post by:
any way to prevent displaying the previous and next months in the calendar control? i have tried just blanking the text out in the dayrender IsOtherMonth and also dynamically changing the...
0
1111
by: Rahul Pareek | last post by:
Hi All, I am developing an Event Management application in asp.net / c#. I use a calendar in which we can enter the events and that events are been displayed under the corresponding date. To...
3
6099
by: ats | last post by:
Does anybody have any sample code for calculating the date for teh last Friday in each month. TIA -- ats@jbex When an old lady got hit by a truck I saw the wicked gleam in your eyes
37
14895
by: mazwolfe | last post by:
I'm new here, so excuse me if my style is incorrect. Can anyone come up with a better method for this calculation? Code: int is_leap(int year) { switch (year % 19) { case 0: case 3: case 6:...
1
2593
by: peetersb | last post by:
Hi, I want ot make functions like this: int getFirtDayOfWeek(int weeknumber, int year); int getLastDayOfWeek(int weeknumber, int year); Firts I calculate the count of weeks like this: ...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.