I guess this is gonna hurt a lot of eyes but it works perfect for my case.
This is not the way I am suppose to work in drupal so if anyone can (help me) convert this to a hook or small module, i would love that.
I added the following code to my node--event.tpl.php to show a table of all results for the current node without a few unwanted results like e-mail.
// Create connection
$con=mysqli_connect("******","*******","********","*********");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Get submitted data from current nodeform
$result = mysqli_query($con,"SELECT data, cid, sid, nid FROM webform_submitted_data WHERE nid=".$nid);
$data = array();
$i =0;
while($row = mysqli_fetch_array($result)) {
$data[$i]['data'] = $row['data'];
$data[$i]['sid'] = $row['sid'];
$data[$i]['cid'] = $row['cid'];
$data[$i]['nid'] = $row['nid'];
$i++;
}
// Get headers for submitted data
$result = mysqli_query($con,"SELECT name, form_key, cid FROM webform_component WHERE nid=".$nid);
$headers = array();
while($row = mysqli_fetch_array($result)) {
$headers[$row['cid']]['name'] = $row['name'];
$headers[$row['cid']]['form_key'] = $row['form_key'];
}
// Declare variables for composing table
//unwanted fields
$unwanted[] = 'productid';
$unwanted[] = 'e_mail';
$unwanted[] = 'algemene_voorwaarden';
$newCello = '<td>';
$newCellc = '</td>';
$presid = (isset($data[0]['sid'])) ? $data[0]['sid'] : '' ;
$tablehead = '<tr class="head">';
$tabledata ='<tr>';
$even = TRUE;
//render table
foreach ($data as $key) {
if ($key['sid'] != $presid) {
$tabledata .= "</tr>";
$tabledata .= ($even) ? '<tr class="even">' : '<tr>' ;
$firstrow = TRUE;
$even = ($even) ? FALSE : TRUE ;
}
//filter unwanted fields
$formkey = $headers[$key['cid']]['form_key'];
if (!in_array($formkey, $unwanted)) {
//create table headers
if (!isset($firstrow)) {
$tablehead .= $newCello;
$tablehead .= $headers[$key['cid']]['name'];
$tablehead .= $newCellc;
}
$tabledata .= $newCello;
$tabledata .= $key['data'];
$tabledata .= $newCellc;
//Get current field sid to compare with the next
$presid = $key['sid'];
}
}
$tablehead .= '</tr>';
echo $tablehead;
echo $tabledata;
mysqli_close($con);
?>
</tr>
</tbody>
</table>