Jump to content

how to display in html table


Go to solution Solved by requinix,

Recommended Posts

I have this table (tblStats):

+------+-----------+------+------------+----------+-------+------+
| P_id | ShortName | logo | SeasonName | SeasonID | Apps1 | Gls  |
+------+-----------+------+------------+----------+-------+------+
|    1 | Friendly  | NULL | 2016/17    |       12 |     1 |    3 |
|    1 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|    2 | Friendly  | NULL | 2016/17    |       12 |     1 |    1 |
|    2 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|    3 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|    3 | NDIV V    | NULL | 2016/17    |       12 |     1 |    1 |
|    4 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|    4 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|   10 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|   10 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|   11 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|   11 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|   12 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|   12 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
|   13 | Friendly  | NULL | 2016/17    |       12 |     1 |    0 |
|   13 | NDIV V    | NULL | 2016/17    |       12 |     1 |    0 |
+------+-----------+------+------------+----------+-------+------+
16 rows in set, 1 warning (0.07 sec)

I  have this query ti get records for a  particular P_id from the table above:

 select P_id,group_concat(ShortName),group_concat(Apps1),group_concat(Gls),SUM(Apps1) as t_Apps,sum(Gls)as t_Gls from (SELECT houseid as P_id, ShortName, logo, SeasonName, SUM(Apps) as Apps1, SUM(Gl) as Gls FROM tblStats where SeasonName='2016/17'  GROUP BY P_id ;

which outputs:

+------+-------------------------+---------------------+-------------------+--------+-------+
| P_id | group_concat(ShortName) | group_concat(Apps1) | group_concat(Gls) | t_Apps | t_Gls |
+------+-------------------------+---------------------+-------------------+--------+-------+
|    1 | Friendly,NDIV V         | 1,1                 | 3,0               |      2 |     3 |
|    2 | Friendly,NDIV V         | 1,1                 | 1,0               |      2 |     1 |
|    3 | NDIV V,Friendly         | 1,1                 | 1,0               |      2 |     1 |
|    4 | Friendly,NDIV V         | 1,1                 | 0,0               |      2 |     0 |
|   10 | Friendly,NDIV V         | 1,1                 | 0,0               |      2 |     0 |
|   11 | Friendly,NDIV V         | 1,1                 | 0,0               |      2 |     0 |
|   12 | NDIV V,Friendly         | 1,1                 | 0,0               |      2 |     0 |
|   13 | Friendly,NDIV V         | 1,1                 | 0,0               |      2 |     0 |
+------+-------------------------+---------------------+-------------------+--------+-------+

But the shorname is not in order as in Friendly,NDIV V.But there is an interchange as we go on.This will affect the data displayed how can I clear this?

Link to comment
https://forums.phpfreaks.com/topic/304145-how-to-display-in-html-table/
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.