[ad_1]
Applications which runs on the end-users machines should never-ever have direct database access. Create a REST API with PHP (if you already using it) which handles the database operations and invoke it with JavaScript (this is the short explanation of AJAX).
[ad_2]
solved INSERT into MySQL database with JavaScript but without Node.js [closed]