I'm not very fluent with MySQL and I ask that you don't toss some advanced techniques my way.
I've run into a problem. I have 2 tables in my database that I need to SELECT from at the same time so I can bind_column ALL of the variables from both databases in one run.
Can someone show me how that'd be done? An example of my two databases and what I'm trying do to is below.
my $data = qq(SELECT FROM db1 name, age, email);
my $sth = $dbh->prepare($data);
$sth->execute() or die $dbh->errstr;
my $data = qq(SELECT FROM db2 height, weight, shoesize);
my $sth = $dbh->prepare($data);
$sth->execute() or die $dbh->errstr;
my ($name, $age, $email, $height, $weight, $shoesize);
$sth->bind_colums(\$name, \$age, \$email, \$height, \$weight, $shoesiz
+e);
while($sth->fetch)
{
print "$name is $age and at $email. Stands at $height, sits and $we
+ight and kicks puppies with size $shoesize shows\n";
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.