SQLite Forum

Sqlite3 Output query to html table

Sqlite3 Output query to html table

(1) By anonymous on 2021-02-28 18:03:21 [link] [source]

Hi just a general query. I have got my sqlite3 app working okay and I can add, read and delete records. I can am using SQLite3 and using C/C++.

What I am looking to do is output the results into a html table that I can display on a webpage. I can output the results to the serial console using printF.

I know that SQLite has the .html mode but as I am working in SQLite3 C/C++ I am not sure about the best way to approach this. Any pointers would be much appreciated. Baz

(2) By Larry Brasfield (larrybr) on 2021-02-28 18:52:25 in reply to 1 [source]

What has .html mode is the CLI shell that is published with SQLite library versions as "shell.c". The code in it is free to use. The code which wraps tabular output in HTML table tags is fairly easy to find. It is also reasonably compact, so it could easily be "the best way" for you (for certain values of "best".)

(3) By anonymous on 2021-02-28 19:11:26 in reply to 2 [link] [source]

Thank you Larry I will check that out. I have SQLITE3 ruuning on a ESP32 microcontroller that is also acting as a web server so had not really considered taking the code from shell commands. All the best Baz