Beefy Boxes and Bandwidth Generously Provided by pair Networks
Ovid Keep It Simple, Stupid  Referencing MySQL Results by Column
by TheBiscuit (Initiate) on May 26, 2010 at 18:08 UTC
( #841773=perlquestion: print w/ replies, xml ) Need Help??
TheBiscuit has asked for the wisdom of the Perl Monks concerning
the following question:  I would like to reduce the number of
MySQL queries executed by running a single SELECT statement then
later referencing the results, preferably by a single column.
Unfortunately, I'm not quite sure how and am hoping for a bit of
help. The SELECT statement looks like this:  $sqlQuery = "SELECT
username,email,phone FROM users"; $sqlResult =
$connect->query($sqlQuery);  Is it possible to somehow reference
a specific row by the username, to pull the email and phone
values? If not, what is the best way to pull the specific
values? This will be done within a foreach loop where the
username is pulled from another source.   Comment on Referencing
MySQL Results by Column Download Code Re: Re