Here is the attached archive: https://yadi.sk/d/Y6akoinZ3Rzv4r . In the attached archive project. The problem itself is in the pass_change.php file, which is associated with the user.php file. When I click change password, it does not change in the database, and the page is clearly reloading.

Here is a piece of code for updating the password in the database:

 $result4 = mysqli_query($link,"UPDATE users SET password='$password' WHERE login='".$_SESSION['login']."'"); //обновляем пароль if ($result4=='TRUE') { //если верно, то обновляем его в сессии $_SESSION['password'] = $password; } } 
  • Cool, that is, we have to download the project, open the files, understand what is wrong and then explain to you? Tell me, do you at least pay for it? - u_mulder
  • I think that it does not work, instead of updating it writes an array - Ilya Pronichkin
  • u_mulder is just a big code and the rear is urgent - Ilya Pronichkin
  • Add your code to the question, but in the comments it is not accepted somehow. ru.stackoverflow.com/help/how-to-ask - LFC
  • on the sql query, everything seems to be checked correctly through a phpmyadmin and sql program. Maybe there is a problem elsewhere? - Ilya Pronichkin

1 answer 1

JQuery ajax example required;

 <input type='password'/> <button id='submit'>Сменить</button> $.post(user.php?change,{data: $('input').val()},function(ajax){ console.log(ajax) //читаем как ругается сервер }) 

====================> user.php

 print_r($_POST) new PDO(.....) $sql = $this->dbh->prepare("UPDATE users set password = ':password' where username = ':username'"); $sql->execute(array(':password' => $password, ':username' => $username)); или используйте готовый mysql driver 

and reloading the brain and the page you will not be =)

  • of course session_start () in $ _SESSION ['user-name'] You keep the username - php