JavaScript + MySql?

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

That is, in php there are standard functions for working with mysql databases, and in javascript I did not notice such functions.

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

Author: newman, 2011-06-05

1 answers

AJAX to help. On the server, you make wrappers to the database functions on the same PHP (with the appropriate prohibitions and checking 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) -> PHP: есть в базе 'Вася'?
PHP: Угу, вопрос нормальный, палева нет, сейчас спрошу у информбюро.
PHP -> MySQL: 'Васю' знаешь?
MySQL -> PHP: угу
PHP -> JS: да, пусть пробует другой логин, ибо второго Васи на не надобно.
 17
Author: Алексей Сонькин, 2011-06-05 14:14:06