Could someone help me to make a code that gets information from MySQL table and then inserts into table something like this:

MySQL table looks like this:
smth----smth1
--1--------a----
--2--------b----
...
Here is the table:
<table width="600" border="1" class="table">
<tr>
<td width="150" height="150">1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td width="150">a</td>
<td width="150">b</td>
<td width="150">c</td>
<td width="150">d</td>
</tr>
<tr>
<td width="150" height="150">5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
<tr>
<td width="150">e</td>
<td width="150">f</td>
<td width="150">g</td>
<td width="150">h</td>
</tr>
</table>
But I don't know how to make it so it gets information from MySQL and inserts into table.