Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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?)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183741]
[Discipulus]: choroba if let your company to hire Tanktalus and marioroy ... what a big fishing!
[Discipulus]: i choice prague!!
[choroba]: 1200 years is enough :-)
[marioroy]: Lady_Aleena my $ans = qx! find . -name "*.pl" -exec ls -l {} \\; !;
[Tanktalus]: My basic problem right now is that if I were willing to move, I could be back in Toronto with a pay raise. We have a number of reasons for not wanting to do that.
[marioroy]: I had to backslash the backslash inside qx.
[Tanktalus]: marioroy++ # nice catch
[Lady_Aleena]: marioroy, that makes kinda makes sense.
[Discipulus]: yes i can survive also in younger town.. but when i passed i saw many strange letters..
[Lady_Aleena]: marioroy, sorry, I am not making sense right now.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-04-23 20:14 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.