Home javascript JavaScript + MySql?

JavaScript + MySql?

Author

Date

Category

Hello! I wanted to ask if it is possible to work with the mysql database via javascript?

That is, php has standard functions for working with mysql databases, but in javascript I did not notice such.

For example: I have a submit form in which the user has entered some information (login for example), and I need to check if there is such a login in the database. And it is necessary that if such a login already exists in the database, then the inscription immediately appears that “Such a login has already been registered”.


Answer 1, authority 100%

AJAX to help. On the server, on the same PHP, make wrappers to the database functions (with appropriate prohibitions and check everything that is possible so that nothing is done in the database) and make requests to it from JS.

There are a lot of articles on this topic on the Internet =) And examples.

JS (AJAX) - & gt; PHP: is 'Vasya' in the database?
PHP: Uh-huh, the question is normal, there is no palette, now I will ask the information bureau.
PHP - & gt; MySQL: Do you know 'Vasu'?
MySQL - & gt; PHP: uh-huh
PHP - & gt; JS: yes, let him try another login, because there is no need for a second Vasya.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions