Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Code factory

by flounder99 (Friar)
on Jul 07, 2003 at 18:07 UTC ( [id://272048]=note: print w/replies, xml ) Need Help??


in reply to Re: Code factory
in thread Code factory

Why not go a step farther?
sub getByFieldval { my ($table, $field, $val) = @_; my $dbh = sqlConnect(); my $sth = $dbh->prepare("SELECT * FROM $table WHERE $field=?"); $sth->execute($val); my $result = $sth->fetchrow_hashref(); $sth->finish(); return $result; }
Of course I would probably do more error checking.

--

flounder

Log In?
Username:
Password:

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

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

    No recent polls found