How to save a HTML table in MySQL database - efficient way to do this? [closed]
I have a php website with a html table. The user is able to modify each of the contained cells (much like in Excel), e.g. change it's content or font-size. My current approach is to save these cells in a one-to-many relationship: One mysql table for the different tables and one mysql table with the cells. To each "table-object" there are several "cell-objects" assigned. The problem I have at the moment is, that this generates really a lot of db querys (about 2200 when saving or opening one table, one for each cell). I think that this really is too much, isn't it (or at least not good way of practice)?
Can anyone give me a hint, what other way I could achieve this? Or is it ok like this anyway?
Thanks in advance,
You could probably collect all the cell data into a multidimensional array of cells split into rows:
$table = array( array(0, 1, 2, 3, 4, 5), array(0, 1, 2, 3, 4, 5), array(0, 1, 2, 3, 4, 5) );
Then serialize the whole array using PHP
serialize() and save it in a single MySQL
When you read from the database, you can just
unserialize() the field and it's back to being a normal PHP array which you can loop through and print out the table.
- A Linux, Apache, MySQL, PHP (LAMP) stack is a combination of open source software that is typically installed together to enable a server to host dynamic […]
- MySQL is an the most popular open-source database management system, in most of hosting company its has been bundle by LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. Another alternative […]
- MySQL is the world’s most popular open-source database. Despite its powerful features, MySQL is simple to set up and easy to use. Below are some instructions […]