Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: I need to tell what I pulled from SQL

by dug (Chaplain)
on Jul 22, 2002 at 17:30 UTC ( [id://184144]=note: print w/replies, xml ) Need Help??


in reply to I need to tell what I pulled from SQL

The execute() method called from your statement handle returns the number of affected rows, as does $sth->{'mysql_affected_rows'}.

*NOTE* I'm think this is mysql specific for selects

You probably want something like:
my $sth = $dbh->prepare( "SELECT * FROM poll WHERE status='waiting' ORDER BY `id` ASC LIMIT 0, 5" ); my $query_count = $sth->execute or die $dbh->errstr; if ( $query_count == 1 ) { # you *can* pull one but just one row using one of the # fetch* methods } else { # your condition isn't met }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found