public function deletePDO($table, array $where = array(), $limit = 1)
    {
        $limit = (int)$limit;
        if (count($where) === 0) {
            return false;
        }
        $q = "DELETE FROM `$table` ";
        $q .= 'WHERE ';
        foreach ($where as $key => $val) {
            if (empty($val)) {
                continue;
            } else {
                $q .= "`$key`=? AND ";
            }
        }
        $q = rtrim($q, 'AND ');
        if ($limit > 0) {
            $q .= ' LIMIT ' . $limit . ' ;';
        } else {
            $q .= ' ;';
        }
        try {
            $this->_queryId = self::$_linkId->prepare($q);
            $i = 1;
            foreach ($where as $key => $val) {
                if (empty($val)) {
                    continue;
                } else {
                    $type = $this->getPDOConstantType($val);
                    $this->_queryId->bindValue($i, $val, $type);
                    ++$i;
                }
            }
            return $this->_queryId->execute();
        } catch (PDOException $e) {
            $this->_error = $e->getMessage();
            return false;
        }
    }
public function deletePDO($table, array $where = array(), $limit = 1)
    {
        $limit = (int)$limit;
        if (count($where) === 0) {
            return false;
        }
        $q = "DELETE FROM `$table` ";
        $q .= 'WHERE ';
        foreach ($where as $key => $val) {
            if (empty($val)) {
                continue;
            } else {
                $q .= "`$key`=? AND ";
            }
        }
        $q = rtrim($q, 'AND ');
        if ($limit > 0) {
            $q .= ' LIMIT ' . $limit . ' ;';
        } else {
            $q .= ' ;';
        }
        try {
            $this->_queryId = self::$_linkId->prepare($q);
            $i = 1;
            foreach ($where as $key => $val) {
                if (empty($val)) {
                    continue;
                } else {
                    $type = $this->getPDOConstantType($val);
                    $this->_queryId->bindValue($i, $val, $type);
                    ++$i;
                }
            }
            return $this->_queryId->execute();
        } catch (PDOException $e) {
            $this->_error = $e->getMessage();
            return false;
        }
    }
public function deletePDO ( $ table , array $ where = array ( ) , $ limit = 1 ) { $ limit = ( int ) $ limit ; if ( count ( $ where ) === 0 ) { return false ; } $ q = "DELETE FROM `$table` " ; $ q .= 'WHERE ' ; foreach ( $ where as $ key => $ val ) { if ( empty ( $ val ) ) { continue ; } else { $ q .= "`$key`=? AND " ; } } $ q = rtrim ( $ q , 'AND ' ) ; if ( $ limit > 0 ) { $ q .= ' LIMIT ' . $ limit . ' ;' ; } else { $ q .= ' ;' ; } try { $ this -> _queryId = self :: $ _linkId -> prepare ( $ q ) ; $ i = 1 ; foreach ( $ where as $ key => $ val ) { if ( empty ( $ val ) ) { continue ; } else { $ type = $ this -> getPDOConstantType ( $ val ) ; $ this -> _queryId -> bindValue ( $ i , $ val , $ type ) ; ++ $ i ; } } return $ this -> _queryId -> execute ( ) ; } catch ( PDOException $ e ) { $ this -> _error = $ e -> getMessage ( ) ; return false ; } }
Delete records from table
@param string $table
@param array $where is an assoc array with keys are column names and values as the actual values
@param int $limit max affected rows count (default - 1)
@return mixed false on failure
Delete records from table