DEV Community 👩‍💻👨‍💻

JackChilds
JackChilds

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: https://github.com/JackChilds/jsmysqldb

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.