[Cascavel-pm] Verificar se veio dados do banco

Ricardo Portilho Proni ricardoportilho em terra.com.br
Quarta Dezembro 13 11:09:32 PST 2006


Não sei se existe uma forma melhor. Deve existir.

$sql="Select * from teste where datahora="2006-12-11 00";
my $ind_dados = 0;
$sth = $dbh->prepare($sql) || die $DBI::errstr;
$sth->execute || die $DBI::errstr;

while (my $ref = $sth->fetchrow_hashref()) {$ind_dados++;}
if ($ind_dados > 0) {Veio dados do banco !\n;}

$sth->finish();

Ricardo Portilho Proni
Oracle Database 10g Administrator Certified Associate
Microsoft Certified Professional
Nerv Informática Ltda.



Patty Silva escreveu:
> Ola pessoal, como faco para verificar se veio dados do banco ou nao?
>
> faco assim:
>
> $sql="Select * from teste where datahora="2006-12-11 00";
>
> $sth = $dbh->prepare($sql) || die $DBI::errstr;
> $sth->execute || die $DBI::errstr;
> $sth->finish();
>
>
>
>
> Quero verificar se a consulta me retornou resultado ou nao..
>
> Alguem pde me ajudar?/
>
> Obrigada
>
> :D
>
> ------------------------------------------------------------------------
> Yahoo! Search
> Música para ver e ouvir: You're Beautiful, do James Blunt 
> <http://us.rd.yahoo.com/mail/br/tagline/search/video/*http://br.search.yahoo.com/search/video?p=james+blunt&ei=UTF-8&cv=g&x=wrt&vm=r&fr=intl-mail-br-b> 
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.15.9/573 - Release Date: 12/5/2006 4:07 PM
>   
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20061213/72c550cc/attachment.html 


Mais detalhes sobre a lista de discussão Cascavel-pm