Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Perl Mysql Null Recordset

by dws (Chancellor)
on Nov 16, 2004 at 21:51 UTC ( [id://408262]=note: print w/replies, xml ) Need Help??


in reply to Perl Mysql Null Recordset

I am using DBI with MySQL and am looking for a way to test if a query returned an empty recordset.

You might have better luck by rephrasing the question as "how many users with this name exist?"

Try something like this (untested):

my $sth = $db1->prepare( "SELECT count(*) FROM users WHERE username = ?" ); $sth->execute($Username_POST); my $rs = $sth->fetchall_arrayref(); my $count = $rs->[0]->[0];

Replies are listed 'Best First'.
Re^2: Perl Mysql Null Recordset
by JoeJaz (Monk) on Nov 16, 2004 at 22:08 UTC
    I have never seen that syntax before. It is very sisinct; I like it. Thanks for providing your code. Joe

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-25 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found