473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Re:Create an html table like this one

Hello guys,
I have posted a question by the date of Jan 10 '10 under the name of Create an html table like this one.
ANd i got this as an answer
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.         s.`complete_name` AS 'from', 
  3.         r.`complete_name` AS 'to',
  4.         COUNT(*) as 'message_count'
  5. FROM    `messages` AS m
  6. LEFT JOIN `groups` AS s
  7.     ON  m.`Group_ID` = s.`id`
  8. LEFT JOIN `groups` AS r
  9.     ON  m.`To_Group_ID` = r.`id`
  10. GROUP BY m.`Group_ID`, m.`To_Group_ID`
  11.  
Expand|Select|Wrap|Line Numbers
  1. $data = array();
  2. while($row = mysql_fetch_assoc($result)) {
  3.     $data[$row['from']][$row['to']] += $row['message_count'];
  4. }
  5.  
Expand|Select|Wrap|Line Numbers
  1. header('content-type: text/plain; charset=utf8');
  2.  
  3. // Print headers
  4. $columns = array_keys($data);
  5. echo "*\t";
  6. foreach($columns as $_column) {
  7.     echo "{$_column}\t";
  8. }
  9. echo "\n";
  10.  
  11. // Print data
  12. foreach($data as $_row_name => $_row_data) {
  13.     // Add the dash (-) for empty cells
  14.     $_row_data[$_row_name] = '-';
  15.  
  16.     echo "{$_row_name}\t";
  17.     foreach($columns as $_col_name) {
  18.         echo "{$_row_data[$_col_name]}\t";
  19.     }
  20.     echo "\n";
  21. }
Now i want to add total of the messages to each row horizontally and vertically, How can i do it.
If you need any more details just ask.
Jun 10 '10 #1
0 1033

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: A P | last post by:
Is this possible? I am planning to export data from SQL that generates HTML table. Instead of selecting the table and then copy then paste to word, I need a script(JS or VB) that will...
2
by: Andreas Bergmeier | last post by:
Hi - I searched quite a bit now but still it seems that one topic was never brought up on oracles xml handling (9i btw). Could anybody tell me how it is possible to create a table out of a xml...
1
by: Ux | last post by:
ServerSide: PHP+MySql ClientSide: JS (IE5+, Moz1.7) I need to edit an HTML table that contains records from a table in MySQL. A MsAccess datagrid or similar behaviour should be the best, but...
4
by: Ajay | last post by:
Hello all, I used to display reports in Excel earlier on my website. Now the client has requested that he would like see reports in Pivot table on the web . The backend is Sql2000. Can you please...
4
by: ruca | last post by:
Hi How can I get a html control in my code? I have a html table that I want the width is defined in code at run time, i.e., I have this table and I have a datagrid. This datagrid have a variable...
7
by: Genus Neduba | last post by:
Hi, is it actually possible to create a table that has a UDT as a column datatype? e.g.: CREATE TYPE addressType AS ( street INTEGER, zip VARCHAR(30)) MODE DB2SQL
8
by: stephen.clancy | last post by:
I have created a Table on the fly with embedded textboxes. I need to update a database based on the input to these textboxes. What's the best approach? Sample of setup; Table table = new...
5
by: =?Utf-8?B?c2NobWlkdGU=?= | last post by:
Hi How can I Export an HTML Table to excel? My goal is a button, and when the user clicks this button a popup appears asking the user to 'open' or 'save' the generated Excel file. Actually...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
11
by: sanju | last post by:
Dear All, I have html table and this table contains 10 Rows and 2 column, I want every time this HTML page is called by the user to view the rows Randomly. How can I do this from JavaScript? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.