Using webform variables I've this hook that gets submitted values from my form which as 2 select options elements and prints the 2 values submitted.function modsubmit_webform_submission_insert($node, $submission)
{
$cont=0;
foreach($submission->data as $val) {
      $value = array_shift($submission->data);
        $value = array_shift($value['value']);
        $data[$cont] = $value;
        $cont=$cont+1;}

drupal_set_message("The value inserted was: {$data[0]},{data[1]}");
}
Now i want to use this two values to make a sql query in db, and the result showed in a table.
I can't get this to work, solutions needed

Thanks
If you want to alter how a submission is rendered, for example adding a table, you need to implement hook_webform_submission_render_alter(). The hook receive the data for the submission in $renderable['#submission'], and the node in $renderable['#node'].

An example of hook_webform_submission_render_alter() is webform_webform_submission_render_alter(), which contains the following code.

function webform_webform_submission_render_alter(&amp;$renderable) {
  // If displaying a submission to end-users who are viewing their own
  // submissions (and not through an e-mail), do not show hidden values.
  // This needs to be implemented at the level of the entire submission, since
  // individual components do not get contextual information about where they
  // are being displayed.
  $node = $renderable['#node'];
  $is_admin = webform_results_access($node);
  if (empty($renderable['#email']) &amp;&amp; !$is_admin) {
    // Find and hide the display of all hidden components.
    foreach ($node-&gt;webform['components'] as $cid =&gt; $component) {
      if ($component['type'] == 'hidden') {
        $parents = webform_component_parent_keys($node, $component);
        $element = &amp;$renderable;
        foreach ($parents as $pid) {
          $element = &amp;$element[$pid];
        }
        $element['#access'] = FALSE;
      }
    }
  }
}


The purpose of hook_webform_submission_insert() is inserting the submitted data in a database. You can use that hook to save the data in a database, and show those data in a page rendered from your module, but hook_webform_submission_insert() is not thought to render any data.
To make a paragon, hook_webform_submission_insert() is equivalent to hook_node_insert() that is invoked when a new node is saved, but that should not render any page.