Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: if (empty record set)

by one4k4 (Hermit)
on Jun 26, 2003 at 15:07 UTC ( [id://269259]=note: print w/replies, xml ) Need Help??


in reply to if (empty record set)

I have thoughts about using any array_ref as your result set from a DB call, as I like using hashref, but that's another thread. Here's what I'd do: (untested for syntax errors)
my $i = 0; while ($sth->fetchrow_hashref){$i++; ##..do other stuff.. } do_your_no_row_stuff($vars) unless $i;
Or
do_no_row_stuff() unless $sth->fetchrow_hashref; ## Of course, the first row is now useless.. but..


One4k4 - perlmonks@poorheart.com (www.poorheart.com)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-20 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found