Jump to content

How do I make a html table out of this mysql result?


ballhogjoni

Recommended Posts

I am having so much trouble with this. I want to create a html table that looks like this:

<table id="datatable">
<thead>
  <tr>
   <th></th>
   <th>test</th>
   <th>test 2</th>
  </tr>
</thead>
<tbody>
  <tr>
   <th>2011-03-17</th><td>1</td><td>0</td>
  </tr>
  <tr>
   <th>2011-03-18</th><td>3</td><td>2</td>
  </tr>
  <tr>
   <th>2011-03-19</th><td>1</td><td>0</td>
  </tr>
</tbody>
</table>

 

out of this mysql result:

opens | name | date

1 | test | 2011-03-17

3 | test | 2011-03-18

2 | test 2 | 2011-03-18

1 | test 2 | 2011-03-19

 

Here is my mysql code:

SELECT count( o.campaign_id ) AS opens, c.name, date(o.created_at) as date FROM opens o LEFT JOIN campaigns c ON c.id = o.campaign_id WHERE (o.created_at between '2011-03-17 00:00:00' and '2011-03-19 23:59:59') GROUP BY date,c.name

 

I also attached a sql dump of my database.

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.