Add a link into a drupal header and table
Instead of returning returning $result-&gt;fetchAll(PDO::FETCH_ASSOC), You need to loop the result and add a link to the array like :

$rows = array();

foreach ($result-&gt;fetchAll(PDO::FETCH_ASSOC) as $row) {
  $rows[] = $row + array('link' =&gt; l('MyLinkText', 'mylinkhere'));
}

return $rows;