MySQL Update Quandry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

I am doing an update to a table as such:

class DB {
....

  function updateMember($email, $password, $postalCode,
                        $language, $id, $word) {

  ...
    if (!(@ mysql_query($query, $connection))) {
      $this->errors = array(mysql_errno(), mysql_error());
      $error = new Error();
      $error->logError($this->errors);
      return false;
    }

    if (mysql_affected_rows() == 0) {
      return false;
    }

    return true;
  }
}



If the user supplies a wrong $word the mysql_affected_rows will be 0 and the method will return false. This is fine. My problem arises when the user supplies data that has not changed. The mysql_affected_rows will be 0 as well. How can I know the difference between an update that fails due to a failed where clause and one that updates nothing?

TIA,
Glenn

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux