Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 chilling in the Monastery: (10)
As of 2015-07-06 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls