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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://183741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found