From: Date: April 26 1999 7:05am Subject: CGI-script crashes in web browser, runs fine in shell List-Archive: http://lists.mysql.com/mysql/2370 Message-Id: <19990426050530137.AAA112@orion.vo.lu@jep_sql> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: CGI-script crashes in web browser, runs fine in shell Cc:=20 At , you wrote: >JEP wrote: >>=20 >> Hello, >> Installed software: >> Linux 2.0.36 (SuSE 6.0) >> running mysql 2.22.21 >> apache 1.3.4 mod_perl 1.17 >> perl 5.005 >>=20 >> When executing for debug purposes a CGI/DBI.pm-based perl script at bash >> prompt, everything fine >> using the Xbase.pm modules, the sript runs fine both at shell prompt and >> using Netscape / IE4, but quite slow, of course >> We migrated the data, build indexes, but the script coughs up a = mysterious >>=20 >> "Error DBD::mysql::st execute failed: ase Selected at line XXX" >>=20 >> We haven't found any reference about this case despite using every search >> engine even in the mailing list archive >> Eternal grafetulness for charitable soul who can help >> TIA >> Jean Eric PREIS >>=20 >> Jep sez: > >Could you provide more detail, such as table schema, >queries, and relevalt prortions of the Perl script? >Sasha Pachev Sure=20 Here's the stuff: very basic dircetkly extracted from PerlCookbok, chap 19 #!/usr/bin/perl=20 use DBI; use CGI qw(:standard :html3 :Carp); use Mysql; print header(), start_html("yo les cakes!"); print start_form; print " ", scalar localtime , "
\n"; print "Moien
\n"; #foreach $key (keys %ENV) { #print $key,"\t",$ENV{$key},"
\n"; #} #print system("whoami"); print textfield('SALUT'),"
\n"; print submit(); print end_form; print hr; # la premiere partie de la form # Le traitement d'un clic sur le bouton if(param()){ print "yo! tu a cherch=E9 le noms correspondant =E0= ",param('SALUT'),"
\n"; =20 =20 # Pour le test avec Xbase # my $dbh =3DDBI->connect("DBI:XBase:/home/jep/exploit/data/DBFS/") or die("ooops\n"); =20 # en exploit, nous sommes sur MySQL $username=3D"username"; $password=3D"password" =20 =20 $dbh =3D DBI->connect("DBI:mysql:database=3Dsqldatas;host=3Dlocalhost;port=3D3306",$u= sernam e,$password) or die $dbh->errstr; my $valeur; $valeur=3D param('SALUT'); $valeur =3D~ s/$\s+// ; $valeur =3Duc($valeur); my $sqlstring; =20 =20 if($valeur =3D~ m/\b[0-9]+/ ){ # un chiffre determine une recherche par l'ID... # Digits means ID number =20 =20 $sqlstring =3D "select id,nomprenom from tree where id like \'"; =20 }else{ # ...un autre caract=E8re, une recherche par le nom # everything else means nomprenom field as criterion string.. $sqlstring =3D "select id,nomprenom from tree where nomprenom like \'"; } $sqlstring .=3D $valeur; $sqlstring .=3D "%\'"; print $sqlstring,"\n"; =20 $sqh =3D $dbh->prepare($sqlstring) or die $dbh->errstr; =20 $sqh->execute or $dbh->errstr; my @data; print ""; @hederz =3Dqw(id nom); print Tr(th(@hederz)); print "
LES RESULTATS
*"; =20 while(@data=3D$sqh->fetchrow() ) # <-- dies here { # tables stuf deleted=09 print $data[0],"\t",$data[1],"\t"; # provides some nice links=09 print a({HREF=3D> "jrfacs.pl?id_query=3D".$data[0]}, qw(Facture ) ),"\t"; print a({HREF=3D> "jrfacs.pl?id_query=3D".$data[0]}, qw(Identit=E9 )),"\t"; print a({HREF=3D> "jrfacs.pl?id_query=3D".$data[0]}, qw(Compte Client= )),"\t"; print a({HREF=3D> "jrfacs.pl?id_query=3D".$data[0]}, qw(Arbre )),"\t"; =09 =09 print "

\n"; =20 $dbh->disconnect; =20 print end_html(); } # la fin du document # As you can see there's no join # table tree is a basic customer description, like ID, nomprenom as char(50) with indexes Jep sez: .....