Your template code includes $wpdb->print_error(). This function prints the last database error between [ and ] brackets, and the executed SQL code. But if there is no error, you just see the empty brackets and the SQL.
$wpdb->show_errors() is used to enable displaying of database errors. If you want to see all database errors, you can just call this function somewhere higher in your code (in your functions.php, or in a plugin). You probably only want to do this when you are in debug mode, so it would look like this:
if ( WP_DEBUG ) {
$wpdb->show_errors();
}
Related Posts:
- How to sort results from a custom database table
- Create WP_Query to search for posts by their categories or their parent/child categories
- SQL error with custom query
- the_date() not working
- 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 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
- Delete post revisions on post publish
- 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 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
- 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
- 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)?
- Why is variable not working on custom sql query using wpdb?
- Any possible way to make $wpdb->get_results() return anything else than array?
- Accessing the database from a plugin outside of action hooks
- Storing Array from returned database query and using the array in a new query
- WordPress not reflecting changed of the database
- mysql query from wordpress page using custom table
- How can I save unique user data on my site? [closed]
- Update results, Before deleting the related category [closed]
- Long running queries
- database sent to a JSON file
- inserting a post from an extern php file but post content doesn’t show on wp site
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Using custom tables for old posts
- WordPress SQL injection
- Not connecting to database in file with multiple MySQL connections
- WordPress Block developer from exporting Database via PHP
- wpdb prepare insert table doesn’t work
- 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
- Most commented posts by time period (last 12h, last 24h and etc)
- I can’t update my data through $wpdb
- 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
- mySQL queries are executed twice on wordpress website
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- WordPress Custom Query: Combining Two Functions
- 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
- Using wpdb to connect to a different database is not working
- How can i limit the number of posts to the most recent 6 in my query?
- getting the values of hidden inputs to use them in a php mysql query
- Insert data from form to database
- Query doesn’t display text data with apostrophes
- How to query a staging database?
- How to do a MySql query in WordPress?
- How can I display a query in a page?
- can’t delete a row from post_meta table
- Include a custom field in mysql query
- How to set max users to 17.000
- two wordpress sites, two themes, one database, same content
- Insert double entry in DB
- Unserializeing multiple column values that are stored in one database results variable
- How to connect database table to each registered wordpress user.
- Check if values exists DB
- Let users register weight each day and save it in DB
- MySQL database migration to WordPress
- Custom query_posts() parameter
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Query Concatenation
- Display total count of products in orders of a specific order status
- 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
- Updates applied to staging WordPress site affecting production even with different databases
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- add role on WordPress in PHP on a second database
- Create a new account on site B with data from the purchase of site A
- Display Results of SQL Query on WP site
- How to search order using database frontend short code WordPress
- Display articles with a different template in the home page | Solved |
- Limiting posts based on nested meta_query
- array wordpress when get is null
- AWS Lightsail WordPress – connect to database on instance using mysqli
- Reading URL Parameters
- Cant create table on plugin activation
- call to undefined function mysql_connect
- Weird fonts showing which are coming from database