Put the date in single quotes and move the parenthesis (after the 'yes'
) to the end:
INSERT INTO custorder VALUES ('Kevin', 'yes' , STR_TO_DATE('1-01-2012', '%d-%m-%Y') ) ; ^ ^ ---parenthesis removed--| and added here ------|
But you can always use dates without STR_TO_DATE()
function, just use the (Y-m-d) '20120101'
or '2012-01-01'
format. Check the MySQL docs: Date and Time Literals
INSERT INTO custorder VALUES ('Kevin', 'yes', '2012-01-01') ;
Related Posts:
- “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
- Mysql: Setup the format of DATETIME to ‘DD-MM-YYYY HH:MM:SS’ when creating a table
- LAST_INSERT_ID() MySQL
- How to convert a string to date in MySQL?
- Get the new record primary key ID from MySQL insert query?
- How to do a batch insert in MySQL
- How to use greater than operator with date?
- SQL – IF EXISTS UPDATE ELSE INSERT INTO
- SQL query to update post_date (one post = one single date & time)
- How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?
- Copyright: Get first and last date of post type
- User set date and time from frontend doesn’t get stored into database
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
- Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (38)
- ERROR 1698 (28000): Access denied for user ‘root’@’localhost’
- How do I restore a dump file from mysqldump?
- ERROR 1698 (28000): Access denied for user ‘root’@’localhost’
- When to use SELECT … FOR UPDATE?
- ERROR 1396 (HY000): Operation CREATE USER failed for ‘jack’@’localhost’
- Create a new database with MySQL Workbench
- Getting “Lock wait timeout exceeded; try restarting transaction” even though I’m not using a transaction
- Search for all occurrences of a string in a mysql database
- #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
- MySQL COUNT DISTINCT
- How to update a record using sequelize for node?
- Can’t open the mysql.plugin table. Please run mysql_upgrade to create it
- Convert MySQL to SQlite [closed]
- How to install Python MySQLdb module using pip?
- Access denied for user ‘root’@’localhost’ (using password: YES) after new installation on Ubuntu
- Dump all tables in CSV format using ‘mysqldump’
- How to check if mysql database exists
- #1062 – Duplicate entry for key ‘PRIMARY’
- If variable equals value php [duplicate]
- How to set initial value and auto increment in MySQL?
- MySQL: Cloning a MySQL database on the same MySql instance
- mysqldump data only
- PHP date() format when inserting into datetime in MySQL
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 2
- WordPress mysqli and PDO
- MySQL Replication Latency Issues in wp-admin pages
- Alternative to mysql_real_escape_string
- Same option_id=0 for 2 options in wp_options?
- How to let a user choose an authors and save it to the database?
- How to remove ‘GROUP BY’ from SQL query produced from get_posts?
- MySQL LIKE not working
- Importing MariaDB into Mysql in WordPress
- Is a MySQL DATETIME or TIMESTAMP value retrieved through $wpdb in UTC?
- Update a WordPress post or page takes 60+ seconds
- Join new table with SQL query
- WordPress installation on valet php 8 (PHP Fatal error: Uncaught mysqli_sql_exception Table ‘wp_options’ doesn’t exist in wp-includes/wp-db.php:2056)
- MySQL crashed because of the large number of requests
- Why doesn’t this code add a table to my database?
- SQL database export-import
- add_post_meta does not respect the content
- Can Someone Help Me Fix This WordPress Missing Argument Error?
- How do I get create a custom table showing the hours remaining for all customers in one page from this transactions page?
- Uncaught Error: Call to undefined function mysql_connect() – WordPress installation
- SQL Database, repeated tables?
- Visual/Text Editor displays blank pages in WP-Admin- but HTML on client side displays correctly
- Code to remove authors with no posts connected to them
- SQL Query in WordPress – Getting Impossible WHERE error
- WordPress create database not working
- database optimization and server errors
- Setting up WordPress Locally on WAMP for a new site (with one already)
- Will reducing mysql permissions hinder WP function? [duplicate]
- Calling mysql_query() on another database, assumes WordPress using that database
- WordPress VIP realpath Alternative?
- querying user bookmarks from a large number of bookmarks
- Pull post name from value of a specific meta key
- PHP variables in mysql query
- Php Mysql Terms
- How to fix the amount of comments displayed for each post?
- How do I echo all users’ display_name and their meta_value who have a certain meta_key?
- How to simulate web traffic to test performance of a website
- SQL query to change custom field in WordPress database
- SQL. Select category descendants
- MySQL Actibity without any active visitors via Google Analytics
- How to configure WordPress Database for CentOS 7
- Why should be SQL keywords, like CREATE TABLE and UPDATE, must be uppercase in WordPress?
- Why is local wordpress install calling live site executions?
- Display MySQL as part of a Page
- Migration of wordpress database from mariadb 10.0.20 to 5.5.50
- WP Meta Query – mixed AND / OR query doesn’t work
- get_results() query not working only when entering strings
- Geographical proximity query using post_meta
- Add value to array in database
- Second completely independent and disposable WordPress installation in subdirectory?
- Making CURDATE() recognize current_time()
- get_results suddenly not working on a single table
- Internal error (500) on local & Fatal error on live when trying to access post type edit screen
- Query sql for truncate post_content in wp_posts table
- How should I troubleshoot a database serialization issue with a WordPress migration
- Foreach only outputs if id is 0
- “Error 1064” when importing msql database after updating wordpress version to 4.2.1
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- mysqldump throws: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)
- How do I load a sql.gz file to my database? (importing)
- Batch Replace URLs in WordPress Database
- How to reduce uncached page generation time?