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

Re: sql select with array

by Ranna (Acolyte)
on Oct 23, 2001 at 07:41 UTC ( #120700=note: print w/replies, xml ) Need Help??

in reply to Re: sql select with array
in thread sql select with array

Or, if you're not stuck on using just $dbh->selectall_arrayref and your database supports placeholders, couldn' you do this?
$sth = $dbh->prepare("SELECT " . '? ' x $#selector . "FROM people WHER +E (fornavn LIKE '%$search%') or (eternavn LIKE '%$search%') or (cpr L +IKE '%$search%'", \%attr); #dunno if you can do the \%attr part... $sth->execute(@selector);
And then you've got a statement handle to get your data from.. I don't know if it's more efficient, but it seems a bit more readable to me.

Replies are listed 'Best First'.
Re: Re: sql select with array
by busunsl (Vicar) on Oct 23, 2001 at 10:09 UTC
    No, you can't. Placeholders are allowed in where clauses and as update values only.

    Well, _some_ DBD's support them in the way you'd use them, but I wouldn't rely on that.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2021-04-18 02:11 GMT
Find Nodes?
    Voting Booth?

    No recent polls found