From the codex:
<?php $wpdb->update( $table, $data, $where, $format = null, $where_format = null ); ?>
In your exampe ‘ CURDATE()’ is simply a string, not a MySQL function (or something else).
The correct syntax for php’s date() is:
date( [format], [timestamp] )
Try this:
$this->wpdb->update(
'wp_competitors',
array(
'results' => $tips, // json
'update_time' => date( 'Y-m-d H:i:s', time() )
),
array( 'token' => $token ),
array(
'%s', // value1
'%d' // value2
),
array( '%d' )
);
Better than php’s date() is WordPress current_time():
current_time( 'mysql' )
This will return something similiar to 2012-12-02 23:00:08
Related Posts:
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- Using nextGen Gallery.. how can I call a list of all Gallery Names?
- Search and replace text across all posts
- bulk post_content update
- [Plugin: Posts 2 Posts] How does it work?
- Post query – show posts from specified day and month and whole years
- Plugin echos text from shortcode function in gutenberg page editor
- WP Query. Is there a maximum size?
- WordPress and a secondary database?
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- WooCommerce search products between price range using WP_Query
- correct validate and sql query
- correct sql query
- SQL query, error
- Create a post builder skin in a plugin
- Taxonomy Drill-Down / Plugin Help – hierarchical queries within plugin?
- How to customize a title by passing query string?
- What is the best way to cache pages on WordPress
- Always get creating a new table with foreign key
- problem with sql query
- add_query_arg not work in admin
- How to return the values from a row where a value occurs for the first time among the rows available?
- How to use apply_filters?
- How to search post titles with whole words only, but not the exact word only?
- Change language on website and change currency with url query
- Displaying different content depending on variable
- How to create algorithm for ordering posts in WordPress?
- Multiple Meta key in search
- Having trouble going from Jfiddle to implementing in WordPress :(
- Proper way to trigger a MySQL query via link in a plugin
- get_var result empty for query of custom table in plugin admin
- WP-Snap too slow (caused by WP_Query?)
- Using wp config to connect to a DB from a plugin
- ‘Active lotteries’ only custom query for woocommerce lottery plugin and elementor
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- Struggling to edit the width of text in ‘Variations’ template
- a weird attribute on every html tag
- Prevent plugin from intruding on wp-json posts api
- Problem of encoding characters (apostrophes) in my posts publications
- Only allowing some emails to create an account [closed]
- AJAX on Front-End Button Click not working – Custom Plugin
- Is there any way to make myself an admin?
- WordPress override archive page template using a plugin
- Warning: Use of undefined constant list_all – assumed ‘list_all’ (this will throw an Error in a future version of PHP)
- How to backup single post in wordpress [closed]
- How can i delete options on plugin uninstallation?
- Plugin Theme CSS [closed]
- Why does my file_exist check fail?
- How do I get the user ID of the user that was updated in WordPress?
- General questions re: WordPress and WP plugins [closed]
- populating a form field with output from a custom plugin function
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- How to distinguish if a plugin is not installed or just not active
- archive_template override when no posts exist
- How to update mu-plugin
- Full list of registered scripts or styles, but from an admin options page
- Advanced Custom Fields – Get value in other plugin file [closed]
- JavaScript in a PHP plugin
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- Checking the count within a foreach loop
- Remove specific plugins and themes from the Dashboard->Updates page [duplicate]
- Create a single website with 3 theme options in wordpress
- Disable Plugin with one button
- Exact Hook to payment methods
- Why shortcode always displayed after footer not in body
- Move plugin-settings to ‘Settings’-menu in the admin
- Installing wordpress on a subdomain of an already existing static website
- Elementor Gallery issue [closed]
- How to replace website?
- changes to header.php not appearing
- List out all the plugins on WordPress instance
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- Understanding State in WordPress Multisites
- Separate database for a wordpress plugin
- Is there a rule for wordpress plugins developers to not do any database changes upon update?
- How to have sample page for each new register users in a membership website
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- HTTP 500 error after plugin install
- Can i add custom code in Source, Header from function.php?
- REST route from a plugin not working if WordPress is installed in a subdirectory
- WHy custom plugin slows down the loading of the pages?
- Plugin development: what to prefix?
- Overwrite a plugin’s CSS?
- Submit Form data to another page via Ajax (WordPress Way)
- Options for math equations rendering in WP in own server
- Support information in backend
- Render content of multiple pages and their descendants
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- Restrict content based on buy woocommerce product
- Can I use register_settings and unregister_setting once the settings page has loaded?
- Overriding post’s font-family
- How to keep variable `$post` to using in another file
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- using do_shortcode
- UpdraftPlus installed malware – scared to download or update plugins now! [closed]
- Why am I unable to load scripts in head in plugin?
- How to make multiple admin pages for one plugin?
- Duplicate New User Registration notices (BuddyPress and bbPress both installed)