Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Question: In undermentioned I am calling bugzilla_QAmembers.cgi script but that does not takes data and displays nothing. Also is "qaname=$Name" I am correctly assigning, please advice.

foreach my $num (keys %bug_d) { $bug_detail{$num} = "<A HREF=\"http://t34.qa.qualys.com/Vulns +igs_Release/cgi-bin/bugzilla_QAmembers.cgi?bug_id=$num&qaname=$Name\" + TARGET=\"_blank\">$bug_d{$num}</A>"; }

MAIN SCRIPT

$q = new CGI; print $q->start_html(); print $q->startform; print $q->strong("Compliance Engineer Details"); print $q->br; print $q->br; print $q->popup_menu( -name=>'Compliance Members', -values=>['Alan Covell','Andy Hu','Chris Russo','Darren Wei','Dianf +ang Gao','David Mcmillan','Jin Wu','Jingyang (Johnson) Liu','Kenneth +trant','Sridhar Gundubogula','Steve Nixon','Stephen willis','Vaibhav +Mehrotra','Wolfgang Kandek'], -default=>'Vaibhav Mehrotra', ); print $q->submit('action','submit'); $Name = $q->param(-name=>'Compliance Members'); print $q->endform; print $q->end_html; my $tankdbh = QualysVulnQA::bugsopen(); sub general_query { my $dbh = shift @_; my $query = shift @_; my $sth = $dbh->prepare($query) || die "Prepare error: $! for sql: $q +uery\n"; $sth->execute() || die "Execute error: $!\n"; my $results = $sth->fetchrow_array(); return $results; } my $Compliance_Member = "select count(*) as count1,bug_status from bug +s,profiles where (bugs.qa_contact=profiles.userid) and product_id = 1 +9 and component_id = 271 and profiles.realname='$Name' group by bug_s +tatus"; my $sth = $tankdbh->prepare($Compliance_Member) || die "Prepare error: + $!\n"; $sth->execute() || die "Execute error: $!\n"; my %bug_d; while (my $rec = $sth->fetchrow_hashref) { $count = $rec->{count1}; $bug_status = $rec->{bug_status}; $bug_d{$bug_status} = $count; } foreach my $num (keys %bug_d) { $bug_detail{$num} = "<A HREF=\"http://t34.qa.qualys.com/Vulns +igs_Release/cgi-bin/bugzilla_QAmembers.cgi?bug_id=$num&qaname=$Name\" + TARGET=\"_blank\">$bug_d{$num}</A>"; }

bugzilla_QAmembers.cgi -- script

#!/usr/bin/perl use strict; #use warnings; use QualysVulnQA; print "<html>"; print '<head>'; print "Content-Type: text/html\n\n"; print '<title>Compliance Bugzilla</title>'; print '<img src="/images/heading_1.gif" alt="[Qualys Intranet]" width= +"678" height="112"></head>'; print '<body BGCOLOR="#638cc8" LINK="Blue" TEXT="black" VLINK="Yellow" + ALINK="Yellow">'; print "</body>"; print "</html>"; my $tankdbh = QualysVulnQA::bugsopen(); my $request_method = $ENV{'REQUEST_METHOD'}; my $query_string = $ENV{'QUERY_STRING'}; my $path_info = $ENV{'PATH_INFO'}; my $content_length = $ENV{'CONTENT_LENGTH'}; # Parse web content my %webin; my @pairs = split(/&/, $query_string); print @pairs; foreach my $pair (@pairs) { (my $name, my $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/^M//g; $value =~ s/~!/ ~!/g; $webin{$name} = $value; } my $Name= $webin{"qaname"}; my $bug = $webin{"bug_id"}; my $new = "select bug_id as Bug_Number,short_desc as Bug_Summary from +bugs,profiles where (bugs.qa_contact=profiles.userid) and product_id += 19 and component_id = 271 and bug_status='$bug' and profiles.realna +me='$Name'"; my $results = QualysVulnQA::generic_db_query($tankdbh,$new); #print $result; #my $status; #SWITCH: { # $status = "NEW", last SWITCH if ($bug == 'NEW'); # $status = "ASSIGNED", last SWITCH if ($bug == ' +ASSIGNED'); # $status = "RESOLVED", last SWITCH if ($bug == +'RESOLVED'); # $status = "VERIFIED", last SWITCH if ($bug == +'VERIFIED'); # $status = "CLOSED", last SWITCH if ($bug == 'C +LOSED'); # } # Output to browser print STDOUT "<HTML><BODY>\n"; #print STDOUT "<CENTER><H3>Compliance Bugzilla Bugs in '$status' State +</H3></CENTER>\n"; print STDOUT "<TABLE BORDER=1>\n"; print STDOUT "<TR><TH>Bug_Number</TH><TH>Bug_Summary</TH></TR>\n"; foreach my $ref (@{$results}) { my $Bug_Number = $ref->{"Bug_Number"}; my $Bug_Summary = $ref->{"Bug_Summary"}; my $bug = "<A HREF=\"https://bugs.intranet.qualys.com/show_bug.cg +i?id="; # TARGET=\"_blank\"; $bug .= $Bug_Number; $bug .= "\">$Bug_Number</A>"; print STDOUT "<TR><TD>$bug</TD><TD>$Bug_Summary</TD></TR>\n"; } print "</TABLE>\n"; print STDOUT "</BODY></HTML>\n";

In reply to Quering database data in perl cgi script by kapoor

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (7)
    As of 2017-12-14 15:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What programming language do you hate the most?




















      Results (396 votes). Check out past polls.

      Notices?