Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: 2 mysql selects in one statement
by renodino (Curate) on Dec 11, 2006 at 22:12 UTC | |
by sulfericacid (Deacon) on Dec 12, 2006 at 16:33 UTC | |
Re: 2 mysql selects in one statement
by chromatic (Archbishop) on Dec 11, 2006 at 22:10 UTC | |
Re: 2 mysql selects in one statement
by planetscape (Chancellor) on Dec 12, 2006 at 02:44 UTC | |
Re: 2 mysql selects in one statement
by CountZero (Bishop) on Dec 12, 2006 at 00:18 UTC | |
Re: 2 mysql selects in one statement
by Devanchya (Beadle) on Dec 12, 2006 at 01:43 UTC | |
Re: 2 mysql selects in one statement
by jbert (Priest) on Dec 12, 2006 at 09:32 UTC | |
Re: 2 mysql selects in one statement
by robot_tourist (Hermit) on Dec 12, 2006 at 12:31 UTC |