How to update table value in wordpress with update query?

Grapy :

Here is the code, I am updating col name custom_status of wp_users table for post data user email. Insert works fine, but the update query is not working.

Code Here:

if (isset($_POST["email_type"]) == 'News' ) {
    $wpdb->update('wp_users', array('custom_status' => 'News'), WHERE, array('user_email' => $_POST["user_email"] ));
}

Thanks for the suggestions.

Dmitry :

You should add third argument which row you will update for example:

if (isset($_POST["email_type"]) == 'News' ) {
    $wpdb->update('wp_users', array('custom_status' => 'News'), array( 'ID' => 1 ));
}

Hope help you.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=8528&siteId=1