Make WordPress Core


Ignore:
Timestamp:
01/07/2010 08:13:54 PM (17 years ago)
Author:
ryan
Message:

Use update and insert. Props DD32. fixes #6836

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/bookmark.php

    r12515 r12652  
    187187
    188188        if ( $update ) {
    189                 if ( false === $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_url = %s,
    190                         link_name = %s, link_image = %s, link_target = %s,
    191                         link_visible = %s, link_description = %s, link_rating = %s,
    192                         link_rel = %s, link_notes = %s, link_rss = %s
    193                         WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id ) ) ) {
     189                if ( ! $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_rating', 'link_rel', 'link_notes', 'link_rss'), compact('link_id') ) ) {
    194190                        if ( $wp_error )
    195191                                return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error );
    … …  
    198194                }
    199195        } else {
    200                 if ( false === $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
    201                 $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss ) ) ) {
     196                if ( ! $wpdb->insert( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss') ) ) {
    202197                        if ( $wp_error )
    203198                                return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error );
Note: See TracChangeset for help on using the changeset viewer.