Forums

wpdb update (1 post)

  1. wordpress4vv
    Member
    Posted 7 months ago #

    Hi

    I am updating a table I created. This is what I am using

    function update_customprofile ($column_value) {
    global $wpdb;
    $wpdb->update('wp_customprofile',array( 'twitter'=>$column_value),
    array( 'id' => get_current_user_id() )
    );
    }

    This function does not work the first time I run because there is no 'id' set yet in the wp_customprofile table, so there is nothing to update. Is there some other function I can use which can create the row if it doesn't exist but if it already exists it just updates it.

    tx.

Reply

You must log in to post.

About this Topic