When using the Moodle database resource, the trick to lining up the column headers with the data, using tables, is to separate the table code between the HEADER REPEATED ENTRY and FOOTER sections. To do this, you need to temporarily turn the HTML off in your user profile.
Here's an example:
Header section
<table width="80%" cellpadding="5" border="1" align="center" class="modulesdata generaltable"><tr>
<th align="left" class="c0 header">Name</th>
<th align="left" class="c1 header">Type</th>
<th align="left" class="c2 header">Requires</th>
<th align="left" class="c3 header">Status</th>
<th align="left" class="c4 header">Summary</th>
<th align="center" class="c5 header"> </th>
</tr>
Repeated entry section
<tr onmouseover="this.className='trhighlight'" onmouseout="this.className='trnormal'">
<td class="c0"><b><a href="##MoreURL##">Name</a></b></td>
<td class="c1">Type</td>
<td class="c2">Requirement</td>
<td class="c3">Status</td>
<td class="c4">Summary</td>
<td align="center" class="c5">##Edit## ##Delete## ##More## ##Approve## </td>
</tr>
Footer section
</table>