I’m pretty sure that first SQL query isn’t correct SQL (insert has different syntax) 😉 It should be:
INSERT INTO {$wpdb->prefix}awpcp_adphotos (ad_id, image_name, disabled, isprimary) VALUES (%d, %s, %d,%d)
In second example, I’m almost sure that ad_id
is not string, and image_name
is not a number. Of cours I’m only guessing, because I haven’t seen this table definition.
Remember that you can always turn error reporting for wpdb on. Just put this line in your code and you will see wpdb errors:
$wpdb->show_errors();
Related Posts:
- Update results, Before deleting the related category [closed]
- select a single val though a table in wordpress
- How to edit the default database of WordPress [closed]
- How to return number of found rows from SELECT query
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- How to use update and delete query in wordpress
- How to make WordPress plugin check for database changes and then do something?
- How To Make Connection To WordPress Data Base In A Plugin?
- Changing user_nicename
- Does WordPress cache get_user_meta() results?
- WordPress will not operate correctly
- How to Join two tables from separate databases within WordPress
- simple wordpress ajax plugin not working when not logged in
- error importing localhost export file to server
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- How to sort results from a custom database table
- How can I call a row of user specific data from a custom table added to the WP Database
- How to merge local and live databases?
- How to track a users progress through pages by inserting data into WordPress Database?
- Import 10,000 Users into WordPress WITH a specific ID for each user
- WP database error for comments_popup_link()
- if statement on database query
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- No wp-config.php file on local install of wordpress – site still displays
- WordPress Ajax Custom Query – High CPU LOAD
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Different database query in function.php using mysqli
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- WordPress Scheduled Event Request Blocking
- Accessing the database from a plugin outside of action hooks
- Create WP_Query to search for posts by their categories or their parent/child categories
- WordPress not reflecting changed of the database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How can I save unique user data on my site? [closed]
- Store a default value for a transient on plugin activation
- Execute long and heavy processes
- wp query foreach deleting record returning only first or last item
- database sent to a JSON file
- inserting a post from an extern php file but post content doesn’t show on wp site
- Using custom tables for old posts
- Not connecting to database in file with multiple MySQL connections
- Custom array from a query only write the last row of the query
- WordPress Block developer from exporting Database via PHP
- Should I use WordPress to skin a database website?
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Building a REST API for your web app exposes primary keys of DB records?
- Most commented posts by time period (last 12h, last 24h and etc)
- I can’t update my data through $wpdb
- Set default Database Storage Engine when creating tables with plugins?
- WordPress WP_Query without query GET parameters
- How do I make this Metabox show current DB value?
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Adding data to custom wordpress database table
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- Add row to custom database Table and delete all rows older than 1 day
- How to display results from a data table with an encrypted user id?
- SQL error with custom query
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Please help! I have a problem with getting wordpress databas
- Error establishing a database connection (Set-up locally)
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- wp_update_post gives 500 internal error
- code that I can run, or a plug in to show what sql tables something pulls information from
- Using wpdb to connect to a different database is not working
- How to import woocommerce custom fields data into another site?
- Need help with format of nested array in MySQL
- The plugin generated 225 characters of unexpected output during activation
- Insert data from form to database
- can’t delete a row from post_meta table
- Send data from plugin to external database
- How to set max users to 17.000
- two wordpress sites, two themes, one database, same content
- Insert double entry in DB
- How to connect database table to each registered wordpress user.
- Let users register weight each day and save it in DB
- MySQL database migration to WordPress
- Custom query_posts() parameter
- MySQL update text field with ‘
- How to pass username into form that sends data to database
- Display total count of products in orders of a specific order status
- Create custom table for wordpress custom registration flow
- Execute multiple PHP Snippets causes error?
- Custom form that stores data in mysql database
- Putting form result in my database
- Can’t insert into a database wordpress
- How get value from URL
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Get updated query results on page after insert in database
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Database query works fine outside WordPress
- Save html content of a widget textarea
- How to use AJAX in WordPress in MYSQL query?
- Passing in MySQL prepare statement parameter separately throwing error
- PHP: Why does my code work in index.php but not a widget?