transpose column to row php html mysql - php

I have some data in a MYSQL database table that I need to "print" in a HTML web page, but I need that this information be shown dynamically in a 3 row and a maximum 12 column table.
Each column must show three sets of information, that will be displayed in each row, like the table below.
Is there a way to do this using PHP and/or HTML?
Thanks for the help

Related

How to fetch and display "unpivot" SQL in php?

I built a table which had to contain 42 columns which would be a large one, I decided to use rows as columns and used a column to add values of the respective fields. I've used dtsid as common entity.
Assuming that there are different values for every dtsid.
If in a page, I set $dtsid = $_GET['dtsid'] and run this url "exam.ple/result.php?dtsid=%Any_dtsid%"
How do I fetch the data and display values in different parts of html using php?

PHP Insert / Update a mysql table from HTML form

This is my first mysql table.
I use HTML form in order to insert datas into a mysql table.
When submited, the form calls a php script in order to add datas into the form.
Then, mySQL table could look as follow :
From this mySQL table how could i generate and display a HTML table sorted by "NEXT_EVENT" column ?
If i want go on step ahead, is there a way a let user click on an upward / downward arrow placed next to each column header (links) in order to get the HTML table sorted as the desired column ?
--
Once the table sorted, i need to generate a raw simple TXT file where the ID on very FIRST row and NEXT_EVENT values will be copied to.
ie, sort.txt :
the 2 fields are comma separed.
2, 1499005140
Many thanks for your help,
To have such a link next to the heading you can use jQuery plugin tablesorter. You can refer at
http://tablesorter.com/docs/
And for just executing a query for one column, you can use ORDER BY clause
Hope it helps

Reordering rows of mysql table fetched dynamically using PHP

I have a page in my web project which displays a complete table fetched from MySQL database. I want to add a option or an extra column on the HTML table that will help to move rows up and down, wherever I want to put it. Like, moving row 1 to row 10, row 2 to row 5, etc. and dynamically making changes in the MySQL table. And also how will I be able to do it on the HTML page by providing some arrows or drag and drop or what ?

excel table variable query

I have a hurdle I need to try to overcome. I have a very large database I need to display in separate little excel tables on a website using html.
I know the structure of how to show an excel table on html code as well as the data inside each cell, but my tables I need to be created will vary in number of rows based on the number of columns of a row of data.
As an example one row with a unique primary key has 18 columns that need to be displayed as column 1 = cell A1, column 2 = cell B1, column 3 = cell A2, column 4 = B2, column 5 = A3.... etc. In the end it will be 9 cells tall and 2 cells wide.
The next table will have 26 columns, the next would have 6 columns... etc.
I think I need to send a query to my mysql database to ask how many columns are in the current queried row, then use that result as variable to build each table to an appropriate size?
I am totally lost at how to approach this. Maybe I need some sub script to run to build each table data string before making it html?
Help!

How to customize exporting query result (PHP mysql) to excel file?

I have some questions about customizing export result(excel) with php. The idea is i want to export my query of my raw data (mysql table) to excel file but with some customization in the result.
for example i want to have result which is summary of the table like below table:
The 3rd column until 7th column is named based on the last 5 days of my report date.
My idea is:
1. create temporary table using format as the result table i want to generate
2. Insert the table with my raw data.
3. Delete those table.
Is that efective?or is there any better idea?
You can always use a view. Which is essentially a select statement with your data in there, and which will be updated whenever your tables are updated. Then you can just do a 'select * from view_name' and export that into your excel.
Depending on the size of the data, there is no need to think about performance.
Edit the data before
You can have a temp table. Depending on the data, this is very fast if you can select and insert the data based on indexes. Then you make a SELECT * from tmp_table; and you have all your data
Edit the data after
You can just join over the different tables, get the data and then loop (read as foreach) over the result array and change the data and export it afterwards

Categories