How do you detect if a specific word is at the end of a the_title()

Try using the post variable to access the post_title

global $post;
$s = $post->post_title;
echo substr($s, 0, strrpos($s, 'on') - 1);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)