• Publicidad

Global symbol "$segundos" requires explicit packag

¿Ya sabes lo que es una referencia? Has progresado, el nível básico es cosa del pasado y ahora estás listo para el siguiente nivel.

Global symbol "$segundos" requires explicit packag

Notapor perlo » 2007-02-14 08:41 @404

No se cual es el error, me pasa con todas las variables; publico el código por las dudas.....
:D Lo que intenta hacer el programa es extraer 2 campos con datos de la consulta y enviarlos por mail

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
my $ayer = UnixDate("yesterday",'%Y-%m-%d');
my $hoy = UnixDate("today",'%Y-%m-%d'); #

my($dbh,$sth,$sth1,$sth2,$mensaje1,$mensaje2,$mensaje3,$mail);
my(@linea1,@linea2,@linea3);

my $sthtest;
###################################################################
#             CONEXION A LA BASE DE DATOS                         #
###################################################################
#$dbh = ConectarBBDD->connect();
$dbh = conexionBD_read();
;
###################################################################
#             CONSULTA A LA BASE DE DATOS                         #
###################################################################
$sth = $dbh->prepare("select sum(A), sum(C)  from tabla;") or die("no funciona " . $dbh->errstr);
$sth->execute() or die("Error de conexion: " . $sth->errstr);

my $traigo = "select sum(A), C from tabla";
my $sthtraigo = $dbh->prepare($traigo)

#$sth1 = $dbh->prepare("select sum(A), sum(C)  from tabla;") or die("no funciona " . $dbh->errstr);
#$sth1->execute() or die("Error de conexion: " . $sth1->errstr);

#$sth2 = $dbh->prepare("select sum(A), sum(C)  from tabla;) or die("no funciona " . $dbh->errstr);
#$sth2->execute() or die("Error de conexion: " . $sth2->errstr);
###################################################################
#             EXTRAIGO DATOS Y PREPARO EL MAIL                    #
###################################################################
#my ($seg1) = $sth->fetchrow_array;
my ($seg2) = $sth1->fetchrow_array;
my ($seg3) = $sth2->fetchrow_array;
my $segundos;
my $ANI;
($segundos, $ANI) = $sthtraigo->fetcrow_array();
$seg1 += 0;
$seg2 += 0;
$seg3 += 0;
my ($mensaje1, $mensaje2, $mensaje3, $mensaje4);
   $mensaje1 = " $segundos  $ANI ";
   $mensaje2 = "";
   $mensaje3 = "";
###################################################################
#             PREPARO EL MAIL                                     #
###################################################################
$mail = MIME::Lite->new(
From =>'[email protected]',
#Bcc=>'',
To =>',
Subject =>'
algo',
Data =>$mensaje1."\n".$mensaje2."\n".$mensaje3."\n".$mensaje4."\n"
) ;
#Pedir que se use SMTP
MIME::Lite->send('
smtp', "algo.com", Timeout => 60 ) ;
###################################################################
#             ENVIO EL MAIL                                       #
###################################################################
# Enviamos el mensaje
$mail->send;                      
###################################################################
#             DESCONEXION DE LA BASE DE DATOS                     #
###################################################################
#Cerramos conexion con BD
$sth->finish;
Coloreado en 0.008 segundos, usando GeSHi 1.0.8.4
perlo
Perlero nuevo
Perlero nuevo
 
Mensajes: 17
Registrado: 2006-11-08 07:55 @371

Publicidad

Como hago...

Notapor perlo » 2007-02-14 10:36 @483

Hola como hago a su vez para que el programa no me traiga solo una linea y me traiga todas...
perlo
Perlero nuevo
Perlero nuevo
 
Mensajes: 17
Registrado: 2006-11-08 07:55 @371


Volver a Intermedio

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados