Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Referencing MySQL Results by Column

by dineed (Scribe)
on May 26, 2010 at 20:38 UTC ( [id://841812]=note: print w/replies, xml ) Need Help??


in reply to Referencing MySQL Results by Column

I believe others have already given appropriate Perl advice. However, if you prefer not to select all rows from the table, which may make or may not make sense depending on the size of the table, you can use a for loop to build a list of user names, and then structure your SQL select statement to use "IN".

$sqlQuery = "SELECT username,email,phone FROM users where username IN +("name1", "name2", ...)"; $sqlResult = $connect->query($sqlQuery);

This should return all the rows you need and then you can process them as needed within your program.

NOTE: I know the "IN" list capability exists in Oracle, so my suggestion is based on the assumption of similar functionality in MySQL.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-16 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found