Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This one is a bit more tricky. This part of my program basically prints out a nice little html table with the coresponding DB values. And it totals the hours and minutes for use in the bottom table. The code seems to work fine, other than the pesky little error.
the error:
Use of uninitialized value in addition (+) at /home/httpd/cgi-bin/nick/timeclock-1.0.1/search.cgi line 260 ( +#1)
And the code:
while (my @row = $common::sql::sth->fetchrow()){ my $daily_time = sprintf("%d:%02d",$row[4],$row[5]); my ($total_minutes, $total_hours, $all_minutes, $total_time_hours, $to +tal_time_minutes); $total_minutes = $row[5]; $total_hours = $row[4] * 60; $all_minutes = $total_hours + $total_minutes; $total_time = $total_time + $all_minutes; $total_time_hours = int($total_time / 60); $total_time_minutes = $total_time % 60; $all_time = sprintf("%d:%02d",$total_time_hours,$total_time_minute +s); ## Make our HTML look better if no data. $row[0] = "&nbsp;" if($row[0] eq ""); $row[1] = "&nbsp;" if($row[1] eq ""); $row[2] = "&nbsp;" if($row[2] eq ""); $row[3] = "&nbsp;" if($row[3] eq ""); $row[4] = "&nbsp;" if($row[4] eq ""); $row[5] = "&nbsp;" if($row[5] eq ""); $row[6] = "&nbsp;" if($row[6] eq ""); my (@date_array01, $print_date, $in_time_sec, @in_time_array, $in_ +time); @date_array01 = split(/ /,$row[2]); $print_date = $date_array01[0]; $in_time_sec = $date_array01[1]; @in_time_array = split(/:/,$in_time_sec); $in_time = join(":",$in_time_array[0],$in_time_array[1]); my (@date_array02, $out_time_sec, @out_time_array, $out_time); @date_array02 = split(/ /,$row[3]); $out_time_sec = $date_array02[1]; @out_time_array = split(/:/,$out_time_sec); $out_time = join(":",$out_time_array[0],$out_time_array[1]); print <<HTML; <TR BGCOLOR="#FFFFFF"> <TD><FONT SIZE=2 FACE=ARIAL>$print_date</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$in_time</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$out_time</FONT></TD> <TD BGCOLOR="#FFFFCC"><FONT SIZE=2 FACE=ARIAL>$daily_time</FONT></ +TD> <TD><FONT SIZE=2 FACE=ARIAL>$row[6]</FONT></TD> HTML } # End of while.

In reply to Yet another Uninitialized value by nlafferty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found