Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: database selecting then validating

by Anonymous Monk
on May 25, 2012 at 11:33 UTC ( #972404=note: print w/replies, xml ) Need Help??


in reply to Re: database selecting then validating
in thread database selecting then validating

You could simplify that into (assuming a unique constraint on (empid, dept)):

my $sql = 'select 1 from users where empid=? and dept=?'; if ($dbh->selectrow_array($sql, undef, $empid, $dept)) { # valid } else { # not valid }

...I'm always a bit wary of using Count(*) for exists-or-not-exists queries

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://972404]
help
Chatterbox?
[Discipulus]: which node yesterday?
[Discipulus]: i cannot see any link to tye post..
[Lady_Aleena]: Hello.
[marto]: teleconf + coffee, I'll post it in a few mins
[beech]: fencepost?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2017-06-23 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (538 votes). Check out past polls.