dbDelta
is really meant for creating databases or tables, not inserting records.
I’d suggest using $wpdb->insert()
, which will escape the values for you:
$wpdb->insert(
$wpdb->prefix . 'w2bw2c_venue',
array(
'market_id' => 7,
'venue_name' => get_the_title( $id ),
),
array(
'%d',
'%s',
)
);
I’ve just used the name field you were having trouble with in my example, obviously you’ll want to fill out the rest. I included market_id to show the correct usage of the second $format
array, ensuring that market_id
is parsed as an integer.
Related Posts:
- How to return number of found rows from SELECT query
- Can i use php sql functions instead of $wpdb?
- $wpdb->delete column values IN ARRAY()?
- Custom query to get post names beginning with a digit
- WordPress get pagination on wpdb get_results
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- Why is variable not working on custom sql query using wpdb?
- Show MySQL errors that occur when I excute $wpdb->insert()
- Can’t get wp_insert_post to work
- WSoD being caused by this piece of code
- I want to select the from values from database in WordPress? [closed]
- Update results, Before deleting the related category [closed]
- wp query foreach deleting record returning only first or last item
- Database query works fine outside WordPress
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- $wpdb->insert() does not Insert record in a table
- Help with a $wpdb MySQL Query
- Custom array from a query only write the last row of the query
- $wpdb returns duplicate posts
- Mixing variables into an array when inserting values
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- Basic wpdb update question
- I can’t update my data through $wpdb
- Output: “Array”
- How to use mysql LIKE with wpdb?
- How to use AJAX in WordPress in MYSQL query?
- form $_post action value gets truncated after it passes through two forms
- Why won’t this wpdb get_results query return results?
- WPDB secure custom form
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- Query the links Database
- MySQL Query Returns Array () In Shortcode
- Passing in MySQL prepare statement parameter separately throwing error
- Convert a column of a table containing an Array as response in HTML
- Database SQL query error
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Conditional formatting on data fetched from MYSQL
- What is the correct way to search 3 custom fields only in WordPress?
- Using wpdb to connect to a different database is not working
- Rewrite SQL query as a prepared statement and use in foreach loop
- Advanced WordPress SQL Query
- MySQL query in WordPress with AJAX
- Passed variable gets undefined variable error on insert on next page
- MySQL queries in WordPress
- Using the same shortcode to show any table from the database
- MySQL database migration to WordPress
- Error resetting database index using ALTER TABLE in $wpdb->query
- Putting form result in my database
- How can I update a value of a field depending on outside source?
- Deprecated: mysql_connect()
- is it possible to run some php code within a wordpress page?
- How to use update and delete query in wordpress
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- queries inside of a class
- MySQL query performed 4 times inside loop
- Show only one post for each author ( Page loads too slow )
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Modern Tribe Calendar wp-query with meta query not working at all
- WP database error for comments_popup_link()
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- Insert all post IDs in new database table
- Is the outdated PHP mysql extension a requirement for WordPress 4.6?
- Get WooCommerce product details and transfer them to a custom DB table
- How can I export posts with featured images, without download them
- What is a valid parent for get_terms()?
- Calculating a large number of MYSQL queries as customshort codes, slow
- Sum the total amount of a specific product purchased per user and display in table
- Error using WordPress $wpdb object to get result from custom table
- How to retrieve the data from the sever and displaying it in a page?
- Make a database query using WordPress
- how to get serialized post meta
- Cannot access $wpdb, comes back NULL
- Using CFDB7 vs Custom MySQL Database [closed]
- Adding data to custom wordpress database table
- Undefined variable: row?
- Removal of all posts content in bulk, keeping the posts itself
- Add posts to custom table in database instead of wp_posts
- How to store checkbox data for individual users?
- Usermeta data unserialize, extract and display in table in WordPress
- I can’t separate the array by commas
- Displaying SQL query result from user input via wpdb
- How can i limit the number of posts to the most recent 6 in my query?
- How do I create a WP endpoint that retrieves all custom post types that have a tag?
- How to grab data from input and store it into custom table in database?
- (Who to follow) Twitter widget
- Update user_email via php – WP 4.7
- How can I display a query in a page?
- Unable to pass variable to database
- How to properly send many mysql queries via php and what happens with ajax requests after they are sent?
- How to set up an auto delete post?
- MySQL update text field with ‘
- How do you get a reference to $wpdb in a PHP script
- Changing regular db connection to $wpdb
- How to get a database field value from a WordPress table? [closed]
- Can’t send form data to wpdb when URL has query string
- $wpdb how to make a record lookup