The problem is that you’re using 'M'
and 'D'
, which are a textual representations, MySQL is expecting a numeric representation of the format 2010-02-06 19:30:13
Try: date('Y-m-d H:i:s')
which uses the numeric equivalents.
edit: switched G
to H
, though it may not have impact, you probably want to use 24-hour format with leading 0s.
Related Posts:
- How to use mysqli_query() in PHP?
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- what does “/index.php?admin/admin_dashboard” in my url mean
- How can I prevent SQL injection in PHP?
- How to create a foreign key in phpmyadmin
- If variable equals value php [duplicate]
- MySQL – count total number of rows in php
- PHP Warning: mysqli_error(): Couldn’t fetch mysqli in
- Foreach only outputs if id is 0
- Which is better and faster ? WordPress Queries or SQL Query
- Grouping posts by a custom meta value
- SQL Query in WordPress – Getting Impossible WHERE error
- Problem with admin login after deployment
- Find out how many times the user has logged in
- WordPress(wpdb class) and mysql stored procedures
- Are these WordPress tables safe to add indexes to?
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- Multiple meta_key in one global $wpdb;
- Custom array from a query only write the last row of the query
- WordPress plugins for database queries
- Is it possible to create a WordPress table using array and loop?
- WordPress member notification
- Update MySQL query so that it functions again
- Can’t Query Custom Table Using $wpdb Method
- SQL syntax error when getting data for a url
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- Database Structure on Different Servers
- WordPress create database not working
- WordPress Block developer from exporting Database via PHP
- Can’t run database query
- Is there a page length limit?
- WordPress doesn’t display accents after migration
- $wpdb returns duplicate posts
- Using WPDB->Insert()
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- Active DB queries in WordPress?
- Update postmeta after theme switch
- How to stop $wpdb from prepending database name
- Mixing variables into an array when inserting values
- Location of core code for database connection and get_header
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- Make a database query using WordPress
- Changing MySQL password via WHM – does this affect WordPress?
- Force Users To Relogin
- Query posts by custom taxonomy and sort by post_modified
- WordPress $wpdb get posts from category and sort by custom meta
- WordPress tables and aliases?
- What’s the sql for this condition?
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Import CSV to MySQL, with custom registration field information
- database optimization and server errors
- WordPress Custom SQL Table with UserID Filter for results
- Locally restoring a ManageWP full site backup
- Create a form with custom autocomplete address field and CSV import values
- WordPress doesn’t save changes some times
- Match tag names with form titles
- Most commented posts by time period (last 12h, last 24h and etc)
- Error missing MySQL extension
- Use $wpdb or other PHP script method to find/replace in WP database
- email alert for product availability
- Run Username SQL Query from WordPress Child Theme Functions File
- How can I add a new row in a separate database when someone registers via WordPress?
- Issue with fetching mysql data and displaying results via shortcode in webpage
- SQL syntax error. However, it works normally at phpmyadmin
- Basic wpdb update question
- Replace a character in all post titles and slugs
- Update Custom Post Type Taxonomies with SQL
- Hide posts if user is added to it WP_query
- How can I fetch data from another website to my wordpress website with mysql database
- Setting up WordPress Locally on WAMP for a new site (with one already)
- I can’t update my data through $wpdb
- A $_POST should occur when submit form but is not?
- WordPress insert query is not working : Showing no Error
- How to get INSERT errors from $wpdb?
- Getting Error Trying to Create Table
- Custom route and query
- Output: “Array”
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- How to unserialize data from MySQL
- How to use mysql LIKE with wpdb?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Copy usermeta value where ID matches in the same table
- string literals in query
- Export Yoast Keywords from MySQL/phpMyAdmin
- Same database; different WordPress
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Some Post Content Does Not Show Up In DB Search
- WordPress WP_Query without query GET parameters
- How do I prepare strings for insertions as values into a MySQL table?
- Known Issues in WordPress When Upgrading PHP to ver 7
- MySQL query for taxonomy-meta
- Array Formation Issue
- Using CFDB7 vs Custom MySQL Database [closed]