MySQL Update Quandry

From: Date: Fri, 25 Nov 2005 18:10:55 +0000
Subject: MySQL Update Quandry
Groups: php.db 
Request: Send a blank email to php-db+get-40727@lists.php.net to get a copy of this message
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

« previous php.db (#40727) next »