Make WordPress Core

Ticket #26106: 26106.2.diff

File 26106.2.diff, 621 bytes (added by UmeshSingla, 11 years ago)

Allow to update all rows in a table

  • wp-includes/wp-db.php

     
    17851785                        $wheres[] = "`$field` = {$form}";
    17861786                }
    17871787
    1788                 $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
     1788                $wheres = empty ( $where ) ? '1 = 1' : implode( ' AND ', $wheres );
     1789
     1790                $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . $wheres;
    17891791                return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
    17901792        }
    17911793