Hi guys,
I am starting to work a lot with perl DBI and mysql a lot lately.
One of the bigger issues that I am having is that whenever I do a select
statement to grab variable froma db.. is seems that they are always
returned as arrays.
It there a way I can issue a select statment an have it return two
variable, not arrays?
For example...
$sth = $dbh->prepare( q{
SELECT dailypath, hostname FROM tblControl
WHERE hostId = ?
} );
$sth->execute ( 543 );
#--have it return these values-----#
$dailyPath = "value of the dailypath in SELECT statement above";
$hostname = "value of hostname in SELECT statment above";
#----------------------------------#
$sth->finish ();
I sure it has got to be something so simply that I am just over
looking. It just seems that what I am doing now is just too much work
to grab a variable:
$sth = $dbh->prepare( q{
SELECT dailypath, hostname FROM tblProcess
WHERE hostId = ?
} );
$sth->execute ( 543 );
$sth->bind_columns( \$dailypath, \$hostname );
while ( $sth->fetchrow_array () ) {
push @dailypath, $dailypath;
push @hostname, $hostname;
}
$sth->finish ();
then I just call the value as $dailypath[0] or $hostname[0] which
seems totaly stupid to me. But it's working right now. ;^)
Hopefully some one can tear me up and tell me the corrct way to do
this??
thanks for the abuse..and help
chad
--
chad kellerman <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
