Unable to generate html using theme_table in block view I have created a block_view, In that block I want to show dynamic table.

I have written following code.

$table_headers = array(t('User'), t('Relation'),t('Period') );
foreach ($result as $row) {
            $table_rows[] = array(
            $row-&gt;name,
            $row-&gt;relation,
            $row-&gt;period_from,
           );
         }
 dpm($table_rows); 


In above $table_rows array, I am getting following elements



If I am using

$table_html = theme_table($table_headers,$table_rows);
$block['content'] = $table_html;


then getting following error on page

The website encountered an unexpected error. Please try again later.


If I used 

$table_html = theme('table',$table_headers,$table_rows);
dpm($table_html); 
$block['content'] = $table_html;


I am getting following html on page



Please suggest were I made mistake and what should I do.
Assuming Drupal 7, and assuming $table_rows and $table_headers contain valid data, this is what you need:

$block['content'] = [
  '#theme' =&gt; 'table',
  '#rows' =&gt; $table_rows,
  '#header' =&gt; $table_headers,
  '#empty' =&gt; 'Nothing to see here...',
];