Filtered table in wordpress

Ok I got my answer

if($char)
{
   $results = $wpdb->get_results( "SELECT * FROM teacher_directory where Name LIKE '$char%'", ARRAY_A  );
   if(!empty($results))
   {   
         //Printing the table here
   }
}

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