Exemplo n.º 1
0
 /**
  * Deletes the rows matching the condition
  * @access public
  * @param array|string cond The conditions to identify the rows that should be deleted. The syntax rules are the same as for $cond in Database::get()
  * @param bool $limit Limit the number of deleted rows
  * @param bool $OR Whether the conditions should be treated as alternatives (true) or multiple resraints (false)
  * @return int Number of rows deleted
  */
 function delete($cond, $limit = 1, $OR = false)
 {
     $cond = $this->collapse($cond);
     $this->database->query("DELETE FROM `" . $this->name . "` WHERE " . implode(" " . ($OR ? 'OR' : 'AND') . " ", $cond) . ($limit ? ' LIMIT ' . Database::formatLimit($limit) : ''));
     return mysql_affected_rows($this->database->Connection);
 }