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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.