Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Perl Monk, Perl Meditation
 
PerlMonks  

Re: If no results come back ...

by screamingeagle (Curate)
on Jul 21, 2002 at 03:21 UTC ( #183741=note: print w/ replies, xml ) Need Help??


in reply to If no results come back ...

you could also do :

if($id) { $sql = "SELECT count(*) FROM category WHERE parent = '$id'"; } else { $sql = "SELECT count(*) FROM category WHERE parent = '0'"; } $sth = $dbh->prepare($sql) || die "Error: $!"; $sth->execute or die $dbh->errstr; my ($count) = $sth->fetchrow_array; if ($count > 0) { print qq... <Then fire the sQL which gets the data>


Comment on Re: If no results come back ...
Download Code
Re: Re: If no results come back ...
by andrew (Acolyte) on Jul 21, 2002 at 03:31 UTC
    It has to be in a while or for statement cause it gets more than 1 row
      so what is the problem? ( why don't you just put it in a while or for loop or do you need further instruction?)
        further

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-04-17 00:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (436 votes), past polls