Make WordPress Core


Ignore:
Timestamp:
10/13/2007 02:36:38 AM (17 years ago)
Author:
markjaquith
Message:

Forget about 4th update() param -- only accept named array. Roll out more insert()/update() and various cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r6239 r6240  
    267267     * @param string $table WARNING: not sanitized!
    268268     * @param array $data should not already be SQL-escaped
    269      * @param mixed $where_col_or_array if a string, it represents the column of the WHERE statement.  If an array (named), it can represent multiple col = 'value' pairs that will be joined with ANDs  WARNING: the column names are not sanitized!
    270      * @param string $where_val the value of the WHERE statement.  Should not already be SQL-escaped.
     269     * @param array $where a named array of WHERE column => value relationships.  Multiple member pairs will be joined with ANDs.  WARNING: the column names are not currently sanitized!
    271270     * @return mixed results of $this->query()
    272271     */
    273     function update($table, $data, $where_col_or_array, $where_val=NULL){
     272    function update($table, $data, $where){
    274273        $data = add_magic_quotes($data);
    275274        $bits = $wheres = array();
     
    277276            $bits[] = "`$k` = '$data[$k]'";
    278277
    279         if ( is_string( $where_col_or_array ) )
    280             $wheres = array( "$where_col_or_array = '" . $this->escape($where_val) . "'" );
    281         elseif ( is_array( $where_col_or_array ) )
    282             foreach ( $where_col_or_array as $c => $v )
     278        if ( is_array( $where ) )
     279            foreach ( $where as $c => $v )
    283280                $wheres[] = "$c = '" . $this->escape( $v ) . "'";
    284281        else
Note: See TracChangeset for help on using the changeset viewer.