title: Proper Use of MYSQL UPDATE Function
body: <p>I am using MySQL query to UPDATE the information in the database.</p>
  
  <p>I tried updating the information from the localhost/phpmyadmin and later on copy the code that was given in the localhost/phpmyadmin.</p>
  
  <p>The problem is that the information/values are not updating in the database.</p>
  
  <p>Below is the code:</p>
  
  <pre><code>&lt;?php
  
     if(isset($_POST['updateProfile']))
       {
         $newUser = $_POST['newUsername'];
         $newPass = $_POST['newPassword'];
         $newConNum = $_POST['newContactNumber'];
         $newAdd = $_POST['newAddress'];
  
      include("dbconnect.php");
  
      //avatarPATH
      $filepath = "avatar/owner-".$_SESSION['username']."-fname-".$_SESSION['fname']."-l_name-".$_SESSION['lname']."-filename-".$_FILES["file"]["name"];
  
    $checkQuery = "SELECT * FROM `users`.`info` WHERE username = '".$userName."' ";
                  $checkResult = $con-&gt;query($checkQuery);
                  $count = mysqli_num_rows($checkResult);
  
                      while ($rows = mysqli_fetch_array($checkResult, MYSQLI_ASSOC))
  
                          {
                              $username = $rows['username'];
                              $userpass = $rows['password'];
                              $firstName = $rows['firstname'];
                              $lastName = $rows['lastname'];
                              $ConNum = $rows['contact_number'];
                              $usrAdd = $rows['user_address'];
                              $avaImgPth = $rows['avatar_image_path'];
                              $adminLvl = $rows['admin_level'];
                          }
  
                  $query = "SELECT * FROM `users`.`info` WHERE username = '".$newUser."' ";
                  $queryResult = $con-&gt;query($query);
                  $result = mysqli_num_rows($queryResult);
  
                      if($result == 1)
                          {
                              echo $newUser." is already in use";
                          }
  
                      else
                          {
                              move_uploaded_file($_FILES["file"]["tmp_name"], "avatar/owner-".$_SESSION['username']."-fname-".$_SESSION['fname']."-l_name-".$_SESSION['lname']."-filename-".$_FILES["file"]["name"]);
  
                              //$updateQuery = "UPDATE `users`.`info` SET `username` = $newUser, `password` = $newPass, `contact_number` = $newConNum , `user_address` = $newAdd, `avatar_image_path` = $filepath WHERE `info`.`username` = '$username' AND `info`.`password` = '$userpass' AND `info`.`f_name` = '$firstname' AND `info`.`l_name` = '$lastname' AND `info`.`admin_level` = '$adminLvl'  AND  `info`.`contact_number` = '$ConNum' AND  AND  `info`.`user_address` = '$usrAdd' AND  `info`.`avatar_image_path` = '$avaImgPth' ";
  
                              $updateQuery = " UPDATE  `users`.`info` SET  `username` =  '$newUser',`password` =  '$newPass',`f_name` =  '$firstName',`l_name` =  '$lastName',`contact_number` =  '$newConNum',`user_address` =  '$newAdd',`avatar_image_path` =  '$filepath' WHERE  `info`.`username` =  'username' AND  `info`.`password` =  'userpass' AND `info`.`f_name` =  'firstName' AND  `info`.`l_name` =  'lastName' AND  `info`.`admin_level` =$adminLvl AND  `info`.`contact_number` =  '$ConNum' AND  `info`.`user_address` =  '$usrAdd' AND `info`.`avatar_image_path` =  '$avaImgPth' ";
  
                              echo "Profile successfully UPDATED!";
                          }
  
              }
      ?&gt;
  </code></pre>
  
  <p>Thank you so much for your response.</p>