DEV Community


Posted on

Use Vanilla JS to read MYSQL databases

I have recently built a project that allows you to read mysql databases on your server.

Example of how to read table 'blog_posts' and output the first 100 posts into a table:

const config = {
  "table" : "blog_posts",
  "limit" : "100",
  "offset" : "0"
_POST_REQUEST("link-to-server/database.php", 'config=' + JSON.stringify(config), (response) => {
  document.querySelector('#myTableContainer').innerHTML = _json2table(JSON.parse(response));
Enter fullscreen mode Exit fullscreen mode

See Github:

Top comments (0)