PHP Insert / Update a mysql table from HTML form - php

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

Related

get the level of current row in recursive or linked list like table ,

my table contain the following fields
code , name , upper_code
I can use code value in upper code field and so on, is there a way to query which level is deep the row with code I choose , I use this table to record financial chart of accounts
A loop that keeps on searching until upper_code is null or not found. You can do that in PHP or in a stored procedure.
There are alternatives but require that you change the structure of your database.

transpose column to row php html mysql

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

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 ?

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

How to export part of a table as SQL in Adminer?

In Adminer, I can export whole tables with the "Export" menu option. When I enter a query, I can export the results as .CSV or .TSV, but not as SQL.
Is there any option to do so? A plugin or a config switch?
Adminer doesn't offer SQL export of a general SQL query because the query may join more tables which would be impossible to export to SQL.
To export a subset of rows in a single table, go to the Select view of this table, filter the results as you wish and check the rows you want to export (or check 'whole result' to export all rows in the result). Then use the Export button under the table.
In current version it is possible with Search
Select column
Select SQL as mark
Into value field fill subquery IN (SELECT id FROM ...)
if you click on export then on that page see there is a radio button named dump. put no of rows you wanted to pick up and starting record index number. then you will get your expected result
Here is how I did this:
Go to Adminer-> Click on Dump in top left side.
Output-> check save radio button
Format-> check SQL radio button
Go to below Export button
Mark checkboxes of Tables (if you want to data then mark checked Data)
If you want 1 table then mark one checkbox of a table.
Click on Export button.
Here we go :), Coool ;)

Categories