# $dbh contains your database handle my $sth = $dbh->prepare( "SELECT * FROM foo WHERE id = ? AND bar = ?" ) or die( "Could not prepare statement: ".$dbh->errstr() ); #of course you will have a more elegant error handling method than just die $sth->execute( $value_for_id, $value_for_bar ); #and then just fetch the data like you would normally.