Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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>

Replies are listed 'Best First'.
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 daffodils sway...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-12-03 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (60 votes). Check out past polls.