I am having a problem displaying data in a certain way from an SQL table...
Take the following example of code:
$q = mysql_query("SELECT data FROM table") or die(mysql_error());
echo"
<table>
<tr>
<th>Result</th>
</tr>";
while($row = mysql_fetch_array($q)){
extract($row);
echo"
<tr>
<td>$data</td>
</tr>";
}
echo"</table>";
if there are 6 rows of data in the table the output will look like:
<table>
<tr>
<th>Result</th>
</tr>
<tr>
<td>data 1</td>
</tr>
<tr>
<td>data 2</td>
</tr>
<tr>
<td>data 3</td>
</tr>
<tr>
<td>data 4</td>
</tr>
<tr>
<td>data 5</td>
</tr>
<tr>
<td>data 6</td>
</tr>
</table>
What php code will produce the following html output?:
<table>
<tr>
<th colspan=3>Result</th>
</tr>
<tr>
<td>data 1</td>
<td>data 2</td>
<td>data 3</td>
</tr>
<tr>
<td>data 4</td>
<td>data 5</td>
<td>data 6</td>
</tr>
</table>
Thanks