Numbered placeholders don’t work as you’d expect, and are going to be removed altogether at some point in the future, so should be considered invalid syntax.
So with this in mind, the error describes the problem- your query has 7 placeholders, but you only pass 4 values. For the repeated values, you just need to repeat them where you pass the substitutions.
Related Posts:
- Add custom post notice after post delete
- wp_logout_url() – WordPress Failure Notice
- Notices on the front-end
- Alter admin notices to remove message that contain a certain string
- PHP Notice: Undefined offset: 0
- Plugin activation/deactivation page transitions with page parameters, then vanished
- Using wpdb to connect to a separate database
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- How do I check for a duplicate record before inserting using wpdb
- wpdb->insert multiple record at once
- $wpdb->insert is changing a value
- Actions or filters fired when data is saved in a custom table
- wpdb Custom Meta Data with 2 conditions
- Custom $wpdb Query for Custom Post Type by Category
- Is it possible to set a option, and then redirect to another page directly from a admin notice link?
- Can’t pass table to $wpdb->prepare
- how to execute different sql query in non-sanitized $wpdb->get_results function
- Change message given when deleting post from custom post type
- $wpdb Query Result not coming but in phpmyadmin it works [closed]
- Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]
- How to notify the admin about something that happened during a cron job
- Exclude subscriber users from user list
- Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb
- Inserting large amounts of data into a custom table during plugin install
- What is the callback sent to add_submenu_page() invoked by WordPress?
- $wpdb select date range of posts
- Extracting the post_id via the wp_insert_post action (external db query)
- Rolling Back from current WordPress version to previous one
- SQL query for custom taxonomy slugs
- Can’t get wp_insert_post to work
- wp_create_user not properly entering password
- Wp_query function to search from product_title ‘OR’ product tags name
- Intermittent database errors when accessing WordPress database
- Storing data in wordpress database from ajax call from different website
- Foreach loop not working as expected – custom tables and references while submitting a form
- Update from 4.5 to 4.6 failing
- Undefined offset: 0
- Connect to separate database using $wpdb and authenticate user
- wpdb custom tables without plugin
- how to use $wpdb->prepare to update a custom table
- Super administrator db name
- Creating a post from data returned from HTML form
- Sorting main query by custom taxonomy slug
- Accessing two databases wordpress
- how to assign content to a different author while loading content
- How to pass orderby params to $wpdb->prepare()?
- Have working sql query… trying to adjust it to use $wpdb
- $wpdb->query can’t insert data
- Build index page from custom fields
- Register custom table for WP to use in a plugin
- wpdb->get_row is selecting the variable as a column name
- Problem migrating to localhost
- How to get INSERT errors from $wpdb?
- wpdb Cannot Update column in Database
- Display category names on edit user profile using $wpdb
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- Problem with display data from get_option
- How do I prepare strings for insertions as values into a MySQL table?
- WPDB – Read and write value from / to database
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- wpquery properties last_query and last_result : should these be public or private?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- wpdb update multiple row?
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Why doesn’t my Table get created?
- Formatting a date/time returned from a custom $wpdb query
- Trash Bin for Categories?
- See if the email exists or not
- How to display specific data from a custom table to logged in users with a custom role
- wpdb->insert with special chars failing with collation utf8mb4_unicode_520_ci
- How to escape percentage sign(%) in sql query with $wpdb->prepare?
- Hide all Admin Notices and move on a separate page
- $wpdb->delete not working for me
- How to securely controlling data without keeping it in postmeta?
- Using wpdb to connect to a different database is not working
- Images names not inserting in WordPress Database from Dynamic Add / Remove fields
- Find out if post was just updated on post edit screen
- Update custom table on metabox POST
- Should I Use only wpdb Class to Write Custom Queries?
- CONCAT_WS in custom sql query
- Use $wpdb->get_results with filter based on array
- Include post_status check within $wpdb query
- wpdb get_row database query inquiry
- Depreciated Call -> Function wpdb::escape()
- Run insert if no entry otherwise run update with ajax
- Inserting and updating rows with wpdb indreases integer fields by 1 point sometimes
- Save/retrieve form data best practises for theme development
- wp-postratings: list current user’s unrated posts
- MySQL database migration to WordPress
- Error inserting row into table
- How does offset works on pagination? (get_results)
- How to reference same column name but different table in custom db query
- Retrieving custom field array value through db query
- $wpdb->get_var returns 0
- $wpdb Ajax not redirecting to main page
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- Uploading to WordPress Database
- WPDB query suddenly not working