最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - I can't update my data through $wpdb

programmeradmin2浏览0评论

I am trying to update my sql data through $wpdb, but can't... If anyone can help what's the real issue?

$updated_version = $wpdb->update('wp_visitors', array('views' => $updated), array( '%d' ));

I am trying to update my sql data through $wpdb, but can't... If anyone can help what's the real issue?

$updated_version = $wpdb->update('wp_visitors', array('views' => $updated), array( '%d' ));
Share Improve this question asked May 1, 2019 at 4:12 Musaf HanifMusaf Hanif 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

You're missing your where statement. You need to tell wpdb which row it should be updating, otherwise you're looking to insert rather than update.

From the $wpdb::update Codex:

wpdb->update( string $table, array $data, array $where, array|string $format = null, array|string $where_format = null );
发布评论

评论列表(0)

  1. 暂无评论