AdrianJ217 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, the code below is a cgi file and I am having problems displaying the image and style from an external css file. The code is in lines 18-28 and I'm not sure what I am doing wrong. I would appreciate any help.
#!/usr/bin/perl -w use strict; use DBI; use CGI; use CGI::Carp('fatalsToBrowser'); my $query = new CGI; print $query->header(); my $my_database = "TrypSnoDB"; my $localhost = "localhost"; my $dsn = "DBI:mysql:$my_database:$localhost"; my $db_user_name = "adrian"; my $db_password = "temp_pass"; my $dbh = DBI->connect("DBI:mysql:database=TrypSnoDB;host=localhost;my +sql_socket=/private/software/mysql/mysql.sock","adrian","temp_pass", +{'RaiseError' => 1}); print "<html>\n"; print "<head>\n"; print "<title>Welcome to the T. Brucei snoRNA Database</title>\n"; print "<link type='text/css' rel='stylesheet' href='/public_html/style +.css'>\n"; print "</head>\n"; print "<body>\n"; print "<h1>Trypanosomatid snoRNA Database</h1>\n"; print "<img class='my_images' src='/public_html/tb_pic1.png'>\n"; print "</body>\n"; print "</html>\n"; if ($query->param('submit1')){ my $orig_sno = $query->param('snorna1'); my $family = $query->param('family1'); my $query_type = $query->param('target_option1'); my $target = $query->param('target_name1'); if ($orig_sno eq "Trypanosoma brucei") { $orig_sno = 1; } elsif ($orig_sno eq "Leishmania major") { $orig_sno = 7; } elsif ($orig_sno eq "ALL") { $orig_sno = "1 or ST.org_id=7"; } if ($family eq "ALL") { $family = "'C/D' or ST.family='H/ACA'"; } else { $family = "'$family'"; } if ($target ne "ALL") { $family = "$family and T.target_name='$target'"; } my($db_query,$common_tar,$exp_ver_sno,$exp_ver_tar,$total); $db_query = "SELECT ST.sno_name,T.target_name,T.location,T.base_pa +ir,SM.annotated_seq FROM sno_Table ST,sno_Modifications SM,Targets T +WHERE ST.sno_id=SM.sno_id and SM.mod_id=T.target_id and (ST.org_id=$o +rig_sno) and (ST.family=$family)"; $common_tar="and T.target_id in(SELECT T.target_id FROM sno_Table +ST,sno_Modifications SM,Targets T WHERE ST.sno_id=SM.sno_id and SM.mo +d_id=T.target_id group by T.target_id having count(*)=2) order by T.l +ocation desc"; $exp_ver_sno="and ST.exper_ver='Y'"; $exp_ver_tar = "and T.exp_ver='Y'"; if ($query_type eq "snoRNAs with common targets") { $db_query=$db_query.$common_tar; } elsif ($query_type eq "Experimentally verified snoRNAs") { $db_query=$db_query.$exp_ver_sno; } elsif ($query_type eq "snoRNAs with experimentally verified target +s") { $db_query=$db_query.$exp_ver_tar; } elsif ($query_type eq "ALL"){ $db_query=$db_query; } my $sth = $dbh->prepare($db_query); $sth->execute(); my$total = $sth->rows; print "<table border=1>\n <tr> <th>snoRNA</th>\n <th>Target Name</th>\n <th>Target Location</th>\n <th>Target Base Pair</th>\n <th>Annotated Sequence</th>\n </tr>\n"; while (my@row = $sth->fetchrow_array()){ my$sno_name = $row[0]; my$tar_name = $row[1]; my$tar_loc = $row[2]; my$tar_bp = $row[3]; my$annotated_seq = $row[4]; print "<tr>\n<td>$sno_name</td><td>$tar_name</td><td>$tar_loc< +/td><td>$tar_bp</td><td>$annotated_seq</td></tr>\n"; } print "<tr> <th>TOTAL</th>\n <th>$total</th>\n </tr>\n"; print "</table>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI and CSS
by marto (Cardinal) on Mar 04, 2014 at 12:26 UTC | |
|
Re: CGI and CSS
by locked_user sundialsvc4 (Abbot) on Mar 04, 2014 at 13:41 UTC | |
by AdrianJ217 (Novice) on Mar 04, 2014 at 17:18 UTC | |
by marto (Cardinal) on Mar 04, 2014 at 17:53 UTC | |
|
Re: CGI and CSS
by McA (Priest) on Mar 04, 2014 at 12:28 UTC | |
by choroba (Cardinal) on Mar 04, 2014 at 12:35 UTC | |
by McA (Priest) on Mar 04, 2014 at 12:40 UTC | |
by AdrianJ217 (Novice) on Mar 04, 2014 at 12:38 UTC | |
by emilper (Novice) on Mar 04, 2014 at 13:06 UTC | |
by AdrianJ217 (Novice) on Mar 04, 2014 at 13:12 UTC | |
by marto (Cardinal) on Mar 04, 2014 at 13:16 UTC | |
| |
by tangent (Parson) on Mar 04, 2014 at 13:40 UTC | |
|
Re: CGI and CSS
by thomas895 (Deacon) on Mar 05, 2014 at 07:36 UTC |