# Open cursor $imm_qy = "SELECT pv.value FROM profile_values pv, profile_fields pf WHERE pv.uid = $uid and pv.fid = pf.fid and pf.name = 'profile_magazine'"; print "\$imm_qy is $imm_qy .\n"; $immh = $dbh->prepare($imm_qy) or die "Cannot prepare magazine query: " . $dbh->errstr . "\n"; # Execute query $immh->execute or die "Cannot execute magazine query: " . $dbh->errstr . "\n"; $imm = $immh->fetchrow_array; $immh->finish; print "For uid of $uid, \$imm is $imm .\n"; #### imm_qy is SELECT pv.value FROM profile_values pv, profile_fields pf WHERE pv.uid = 17 and pv.fid = pf.fid and pf.name = 'profile_magazine' . For uid of 17, $imm is .