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

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

For example: I have a submit form in which the user 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 username is already in the database, then the inscription immediately appears that "This username is already registered."

    1 answer 1

    AJAX to help. On the server, on the same PHP do the wrappers to the database functions (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: да, пусть пробует другой логин, ибо второго Васи на не надобно.