Dynamic <td> generation when retrieving data from database...
| From: | Jonathan Villa | Date: | Fri, 23 May 2003 04:10:02 +0000 |
| Subject: | Dynamic <td> generation when retrieving data from database... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27977@lists.php.net to get a copy of this message | ||
Does anyone have a script which will do the following:
For a shopping cart, I have the merchandise coming from the database
(image references, prices, ids, names, etc.)
When I begin to display the results on the page I want to be able to
specify my <td> colspans and basic HTML table structure dynamically.
For example, if result is 4, I want this
<tr>
<td>image1</td>
<td>image2</td>
<td>image3</td>
</tr>
<tr>
<td colspan=3>image4</td>
</tr>
if it's 5,
<tr>
<td>image1</td>
<td>image2</td>
<td>image3</td>
</tr>
<tr>
<td>image4</td>
<td colspan=2>image5</td>
</tr>
etc.
Any idea, scripts?