[FoLUG] perl dbi e mysql
simona bazzocchi
simona_bazzocchi@yahoo.it
Gio 15 Mar 2007 23:38:28 CET
Mi rispondo da solo.
Non riesco neanche a visualizzare la query da sola senza form nella pagina web.
Nel senso che se faccio sul server perl mysp.cgi, tutto funziona senza errore, se invece cerco di visualizzarla da web non va.
L'errore di apache e' questo:
[Thu Mar 15 17:32:58 2007] [error] [client 140.254.45.26] (2)No such file or directory: exec of '/var/www/cgi-bin/mysp.cgi' failed
[Thu Mar 15 17:32:58 2007] [error] [client 140.254.45.26] Premature end of script headers: mysp.cgi
chmod l'ho impostato 755
Il file mysp.cgi e' questo:
#!/usr/local/rbin/perl -w
use CGI;
use DBI;
use CGI::Carp qw(fatalsToBrowser);
print "Content-Type: text/html\n\n";
print "<html><body>";
# database information
$db="chip3";
$host="localhost";
$userid="simona";
$passwd="xxxxxxx";
$connectionInfo="dbi:mysql:$db;$host";
# make connection to database
$dbh = DBI->connect($connectionInfo,$userid,$passwd);
# prepare and execute query
$query ="select name_mir_chip3, seq_mir_mature_sanger, type from chip3_seq left join join_chip3_sanger_mature on name_mir_chip3=name_mir_mature_chip3 where name_mir_chip3 IN \(\"mmu-mir-294No1\"\)";
$sth = $dbh->prepare($query);
$sth->execute();
# assign fields to variables
$sth->bind_columns(\$name_mir_mature_chip3, \$seq_mir_mature_sanger, \$type);
# output name list to the browser
print "Names miRNA in the chip3 database:<p>\n";
print "<table>\n";
while($sth->fetch()) {
print "<tr><td>$name_mir_mature_chip3<td>$seq_mir_mature_sanger<td>$type\n";
}
print "</table>\n";
print "</body>\n";
print "</html>\n";
$sth->finish();
# disconnect from database
$dbh->disconnect if $dbh;
################################################
Grazie
---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
Maggiori informazioni sulla lista
FoLUG