Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Horizontal And Vertical Presentation Of Db Table

$
0
0
How can I retrieve a row from a database and print it out both horizontally and vertically?

I have a table which contains data in the following columns:

Quote

id, name, date, hour1, hour2, hour3


The data in the table is:

Quote

1, bmw, 2013-03-08, 1, 2, 3
2, audi, 2013-03-09, 4, 5, 6
1, bmw, 2013-03-09, 8, 10, 11


When I retrieve these values from the database I want to print out like this:

Quote

<table>
<thead>
<th>ID</th><th>Name</th><th>2013-03-08</th><th>Hour1</th><th>Hour2</th><th>Hour3</th><th>2013-03-09</th><th>Hour1</th><th>Hour2</th><th>Hour3</th>
</thead>
<tbody>
<tr>
<td>1</td><td>bmw</td><td>1</td><td>2</td><td>3</td><td>8</td><td>10</td><td>11</td>
</tr>
<tr>
<td>2</td><td>audi</td><td><td></td><td></td><td>4</td><td>5</td><td>6</td>
</tr>
</tbody>


Any ideas of how to achieve this in a foreach loop?

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>