php - Change the old password -


hi guys im new programmer can me this, cant change password , keep saying error on echo "password change successful";

please me. thank you.

<?php  if(isset($_post["login"]))      {          if(!empty($_post['oldpass']) && !empty($_post['password']))             {                 $oldp=$_post['oldpass'];                    // connection                 $con=mysqli_connect('localhost','root','') or die(mysqli_error());                 mysqli_select_db($con,'databaseprac') or die("cannot select db");                  // select database                 $query=mysqli_query($con,"select * tblusers password='".$oldp."'");                 $numrows=mysqli_num_rows($query);                     if($numrows!=0)                 {                     while($row=mysqli_fetch_assoc($query))                 {                     $dbpassword=$row['password'];                       //mysqli_close()                     }                      if($oldp == $dbpassword)                     {                       $sql="update tblusers set password='$oldp' id='1';                         $result=mysqli_query($sql);                         if($result)                          {                         echo "<h4>password change successful</h4>";                         }                     }                     }                      else {                         echo "<h4>invalid old password</h4>";                     }               }                     else {                       echo "<h4>all fields required.</h4>";                   }           } ?> 

there's no " @ end of sentence: $sql="update tblusers set password='$oldp' id='1';

also need add $con line: $result=mysqli_query($sql); this: $result=mysqli_query($con,$sql);


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -