如何使用更新查询更新WordPress中的表值?

这是代码, 我正在更新wp_users表的col名称custom_status以用于发布数据用户电子邮件。插入工作正常, 但更新查询不起作用。

此处代码:

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

感谢你的建议。


#1


你应该添加第三个参数, 例如将更新的行:

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

希望对你有帮助。

来源:

https://www.srcmini02.com/63513.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37608.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?