How to connect the site to the MYSQL database?

He is currently working on a website (html 5), which calculates expenses for the user, after calculating the user must save it as a report for future purposes. So I want to know if there is anyway connecting the website to the MYSQL database or any other way, and not creating the database using java script, because I am new to Js.

Thankyou

+4
source share
3 answers

Ideally, you should write server-side code to add this information to the database. this way you can provide access to authorized users (i.e. registered users), and your requests cannot be changed in the browser by any user. you can use a programming language such as PHP (with a framework like Yii, CodeIgniter), which is pretty lightweight.

+3
source

Browsers do not have built-in mechanisms for connecting to a MySQL server.

Your options:

  • Create a browser plugin
  • Write a web service and use JavaScript to create an XMLHttpRequest object to communicate with it.

The second option is the most common (and almost certainly the best, since it does not require the user to install the browser plug-in or provide direct access to the database to all your users).

If you want to use JavaScript, you can create your own web service (e.g.) Node.js and the mysql driver in npm .

+2
source

For this purpose you should use HTML5 Web SQL. Here is a link you can link to: http://www.tutorialspoint.com/html5/html5_web_sql.htm

+1
source

All Articles