#assuming you're connected, with a $dbh #my $sql = "select ? from ?"; #incorrect, thanks wfsp my $sql = "select ? from myTable"; my $sth=$dbh->prepare( $sql ) ; $sth->bind_param(1, $col_to_select ); #$sth->bind_param(2, $table ) ; #also incorrect $sth->execute ;