I often find myself (as I’m sure a lot of you do) creating tables from MySQL results. For example, a contacts table, an addresses table, etc.
Sometimes I do it manually, you know the whole
query = 'SELECT * FROM table WHERE blah blah';
$result = mysql_query($query)
while($row=mysql_fetch_array($result))
$table .= '<tr>';
$table .= '<td>'.$row['id'].'</td><td>'.$row['name'].'</td>';
$table .= '</tr>';
thing
I have created some basic functions to tackle this repetitive code. In fact, I’m gonna create one right now.
Could you please share your solution to avoid similar code when displaying MySQL results?