Hey all ive been trying to get the code bellow to work which should make an update password fourm but im not having much luck if any one can tell me why it's not working i will jump up and down around the room looking stupid lol

<?php
require_once('Connections/koc.php');
require_once('includes/functions.inc.php');
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
if (isset($_POST['submit'])) {
  $invalid = false;
  foreach ($_POST as $key => $value) {
    if (empty($value)) {
      $invalid = true;
    }
  }

  if ($invalid) {
    echo "<p>You must fill in all fields!</p>\n";
  } else {
    if ($_POST['new_pw1_urs'] = $_POST['new_pw2_urs']) {
      echo "<p>New Passwords do not match!</p>\n";
    } else {
      $query = mysql_query("SELECT * FROM login WHERE username_urs = '$_POST[username_urs]' AND password_urs = '" .($_POST['old_pw_urs']) . "'");
      if (mysql_num_rows($query) = 1) {
        echo "<p>Invalid username/password combination!</p>\n";
      } else {
        if (mysql_query("UPDATE login SET password_urs = '" .($_POST['new_pw1_urs']) . "' WHERE username_urs = '$_POST[username_urs]'")) {
          echo "<p>Password updated!</p>\n";
        } else {
          echo "<p>Couldn't update password!</p>\n";
        }
      }
    }
  }
}
?>

<form name='update_pw' action='' method='post'>
Username: <input type='text' name='username_urs' /><br />
Password: <input type='password' name='old_pw_urs' /><br />
New PW: <input type='password' name='new_pw1_urs' /><br />
Confirm New PW: <input type='password' name='new_pw2_urs' /><br />
<input type='submit' name='submit' value='Change it!' />
</form>

</body>
</html>

the error code that keeps been displayed is
Parse error: parse error in H:\server\Apache2\htdocs\koc\TMP25ae9jga7r.php on line 28

the database is called test and the table used is called login and the fields for the username and password are username_urs and password_urs

try changing your line (28) from this...
if (mysql_num_rows($query) = 1) {

to this...
if (mysql_num_rows($query) > 0) {
or if you really need to make sure there is only one record returned ...
if (mysql_num_rows($query) == 1) {

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.