Guest_imported
New member
- Jan 1, 1970
- 0
hi all,
I have a table in my sql database. I'm using perl to access that table. I'm using perl dbi for that.
I am getting a problem in the following line
$statement = "select recordId from hostInfo where hostName ='$machine'";
$sth = $dbh->prepare($statement) || die "couldn't prepare well \n";
$sth->execute || die "could not execute select \n";
($rId) = $sth->fetchrow_array;
print "$rId\n";
It prints a blank line. When I substitue "$machine" with a specific name say 'ab1', then the code works fine and it returns the recordId.
Can anyone please tell me how to incorporate "$machine" in the above ?
Thanks.
I have a table in my sql database. I'm using perl to access that table. I'm using perl dbi for that.
I am getting a problem in the following line
$statement = "select recordId from hostInfo where hostName ='$machine'";
$sth = $dbh->prepare($statement) || die "couldn't prepare well \n";
$sth->execute || die "could not execute select \n";
($rId) = $sth->fetchrow_array;
print "$rId\n";
It prints a blank line. When I substitue "$machine" with a specific name say 'ab1', then the code works fine and it returns the recordId.
Can anyone please tell me how to incorporate "$machine" in the above ?
Thanks.