db::delete PHP Method

delete() static public method

Runs a DELETE query
static public delete ( string $table, mixed $where = '' ) : mixed
$table string The table name
$where mixed Either a key/value array as AND connected where clause or a simple MySQL where clause string
return mixed The number of affected rows or an error response
    static function delete($table, $where = '')
    {
        $sql = 'DELETE FROM ' . self::prefix($table);
        if (!empty($where)) {
            $sql .= ' WHERE ' . self::where($where);
        }
        return self::execute($sql);
    }

Usage Example

Example #1
0
 public function borrar_usuario($id)
 {
     parent::__construct($this->db, $this->tabla);
     $args = array();
     $args["where"] = array("idUsuario=:id");
     $args["valores"] = array(":id" => $id);
     parent::delete($array);
 }
All Usage Examples Of db::delete