You have to include wp-load.php at the begining to work wordpress environment like $wpdb object to interact with database. and also what is your database prefix? in $wpdb->prefix.'wpe6_ymm' is wpe6 is your prefix?