A
A
Anatoly2014-10-15 01:23:51
PHP
Anatoly, 2014-10-15 01:23:51

How to convert html table to mysql/csv?

I get the table with curl from another site, and display it on my own. There was a need to change the data in the table before displaying it on my site.
More specifically:
1. Add to each row a button with an id taken from the first cell of this row. 2. Increase
the cell value by a certain number of times depending on its value (Example: if >= 100 then + 25. If >= 200 then +35)
mysql)
_________________________________________________________________________________________________________________
These points would be easy to implement if they were DB records (mysql), but since this is an html table, I'm looking for a way to convert it to sql before processing.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iliyaisd, 2014-10-15
@messaar

Do you also need to store data for yourself, in addition to the output? If not, then converting to sql is expensive and pointless. Same csv.
I think it's better for you to either use parsing tools (phpquery, simple_html_dom) - parse the table and re-form (or add new cells directly to it), or add cells on the clientside using jQuery or similar tools.

Z
zooks, 2014-10-15
@zooks

HTML to CSV - easy. I do it via Excel import, but you can try LibreOffice Calc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question