I want to make this display only the rows of data that do not have a value in the total_time (data type INTEGER) field. Along with the oid of each row displayed.
#!/usr/bin/perl use CGI qw/:standard/; require "common.sub"; print header; &Create_DB_Connection; &get_info; &print_results; # Disconnect from the database $dbh->disconnect; ################ BEGIN GET INFO SUBROUTINE sub get_info{ $SQL="SELECT oid,* FROM timeclock WHERE total_time = 0 ORDER BY l_na +me"; #my $sth = &Do_SQL; &Do_SQL; } ################ END GET INFO SUBROUTINE ################ BEGIN PRINT RESULTS SUBROUTINE sub print_results{ print <<HTML; <HTML><HEAD><TITLE>Pennswoods.net - Timeclock Search</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF"> <CENTER><FONT SIZE=6 FACE=ARIAL>Search Results</FONT></CENTER> <HR WIDTH=80%> <P> <CENTER><TABLE BORDER=1 CELLSPACING=0> <TR> <TD BGCOLOR="#D7D3B9" COLSPAN=11><FONT FACE=ARIAL> <CENTER><B>Pennswoods.net - Employee Timeclock Database</B></C +ENTER> </FONT></TD> </TR> <TR> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Delete</B></CENTER></FONT></T +D> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Oid</B></CENTER></FONT></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Employee ID</B></CENTER></FON +T></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Date</B></CENTER></FONT></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Name</B></CENTER></FONT></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Clocked In</B></CENTER></FONT +></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Clocked Out</B></CENTER></FON +T></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Total Time</B></CENTER></FONT +></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Start Stamp</B></CENTER></FON +T></TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>End Stamp</B></CENTER></FONT> +</TD> <TD BGCOLOR="D7D3B9"> <FONT SIZE=2 FACE=ARIAL><CENTER><B>Comment</B></CENTER></FONT></ +TD> </TR> HTML while ($pointer = $sth->fetchrow_hashref){ $oid = $pointer->{'oid'}; $emp_id = $pointer->{'emp_id'}; $date = $pointer->{'date'}; $f_name = $pointer->{'f_name'}; $l_name = $pointer->{'l_name'}; $start_hour = $pointer->{'start_hour'}; $start_minute = $pointer->{'start_minute'}; $end_hour = $pointer->{'end_hour'}; $end_minute = $pointer->{'end_minute'}; $total_time = $pointer->{'total_time'}; $start_stamp = $pointer->{'start_stamp'}; $end_stamp = $pointer->{'end_stamp'}; $comment = $pointer->{'comment'}; ## Make our HTML look better if no data. $oid = "&nbsp;" if($oid eq ""); $emp_id = "&nbsp;" if($emp_id eq ""); $date = "&nbsp;" if($date eq ""); $start_hour = "&nbsp;" if($start_hour eq ""); $start_minute = "&nbsp;" if($start_minute eq ""); $end_hour = "&nbsp;" if($end_hour eq ""); $end_minute = "&nbsp;" if($end_minute eq ""); $start_stamp = "&nbsp;" if($start_stamp eq ""); $end_stamp = "&nbsp;" if($end_stamp eq ""); $total_time = "&nbsp;" if($total_time eq ""); $comment = "&nbsp;" if($comment eq ""); print <<HTML; <TR BGCOLOR="#FFFFFF"> <TD><FONT SIZE=1 FACE=ARIAL> [<A HREF="/cgi-bin/nick/contact/delete.cgi?$oid">Delete</A>] </FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$oid</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$emp_id</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$date</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$f_name $l_name</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$start_hour:$start_minute</A></FONT>< +/TD> <TD><FONT SIZE=2 FACE=ARIAL>$end_hour:$end_minute</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$total_time</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$start_stamp</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$end_stamp</A></FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$comment</FONT></TD> </TR> HTML } # End of while. print<<HTML; </TABLE></CENTER> <P> <HR WIDTH=80%> <P> <CENTER> <FONT SIZE=4> <A HREF="http://devel.pennswoods.net/nick/index.html">Main Page< +/A> </FONT> </CENTER> </BODY></HTML> HTML } # End of print_results subroutine ################ END PRINT RESULTS SUBROUTINE

In reply to Display row with no value in column by nlafferty

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.