There is no specific issue with retrieving null values from the database. They will come back as the PHP NULL value.
WordPress uses either the function mysqli_fetch_object
or mysql_fetch_object
to retrieve results from the database.
https://php.net/manual/en/function.mysql-fetch-object.php
https://php.net/manual/en/mysqli-result.fetch-object.php
According to those respective pages:
Note: This function sets NULL fields to the PHP NULL value.
Are you using is_null()
to check for the value? Or are you comparing the result to the NULL constant using the identity check (===
)?
Related Posts:
- MySQL SELECT increment counter
- Populate dropdown from database
- Fill custom select field with pages/post titles
- Get results from wordpress data custom table
- Select From wpdb – Author/User Directory page
- SELECT rows between two datetimes when the range is dynamic [closed]
- Tool to check the database in Production [closed]
- Custom wordpress SQL statement for a website
- How to resolve ORA-011033: ORACLE initialization or shutdown in progress
- Oracle SQL query for Date format
- Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user ‘root’@’localhost'(using password:YES)
- Can I have multiple primary keys in a single table?
- Using wpdb to connect to a separate database
- Database connection close
- How to create bulk page and content? [closed]
- Importing posts from old website to new conflicting post ID’s?
- Exporting revisions
- WP_Options ID high
- Transient RSS feeds in wp_options not removed automatically?
- Best way to move live site local
- The revisions table in my database is at 70% capacity and growing. What should I do?
- WordPress for a very large website
- How to use multiple database in wordpress?
- Database location in WordPress
- WooCommerce with thousands of products – site is very slow – optimize db queries? [closed]
- WP_list_table bulk_action get edit and delete
- How to display data from custom table in wordpress database?
- Is removing orphaned wp_postmeta records safe?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Add search Value to wp_list_table pagination
- stdObject stored in database. How does one convert it to usable format?
- I have a table I created, how do I make a form for a user to filter the data?
- What ALL can cause “Another update is currently in progress.”? [closed]
- Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]
- Trigger Plugin database update after git pull
- Does WordPress ever need multiple databases?
- Why are no posts showing despite my apparently correct DB restoration?
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Cannot update custom database table row
- SQL Error wp_commentmeta – incorrect table definition
- Change WordPress prefix for only one table?
- Two websites one database, administrator not working on second website
- Select two sums with single get_var statement
- How to get the SQL of the changes made to the database from an update or upgrade?
- How can i add custom fields into the contact form 7 [closed]
- Why does importing copies of the database dump and the document root make WordPress data inconsistent?
- Make an Items attribute searchable (taxonomy using existing attribute)
- Store partial database to an archive database time to time
- Move out of sync posts from one database to another
- Migration: Copying database content to a different server
- Remove empty rows from the database
- Check if post id exist in table than only update instead of inserting new row
- Detail explanation of wordpress database fields and metatag list [closed]
- CreateOrUpdate in WordPress
- How to convert srcset links from https to http?
- How to get a list of WordPress default database tables?
- Can local WordPress installs share /wp-content/ folder and database?
- How to transfer from localHost to live but use the already existing database on the server?
- Backing up WordPress database and files
- Safely store code(html/js..) into database
- Creating and Using Tables in the WordPress Database
- Connect a membership plugin to an external database
- Compare User meta_value with Product meta_value
- Storing user’s data on external database on other server
- is it right choose to connect database in template page directly in WordPress site?
- How to insert a value to decimal type field using wpdb->prepare?
- Sql query to get all metadata for a post
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Set a cron job to delete a specific database table table every midnight
- Two separate wordpress installations at one domain
- Is there a way to edit the WP content database in an admin panel or external page?
- Where do I put my create_new_table function()?
- SQL database import #1046 error
- Get all top categories, then only 3 posts for each
- Having all “non-PHP” files on a different server
- syntax error for changing user role from database
- Finding a page holding a specific string/URL that is used in the content
- “wordpress error in establishing database connection” and missing tables
- get_option() does unserialize and don’t remove \
- next comment id number wordpress
- Adding last value from Database as text in WordPress Page
- Merging development site with live site
- Backup Restore turns carriage returns to literal strings
- I have a WordPress 4.6 database dump – how do I use it in a new install?
- Find/ascertain latest wordpress db from multiple database copies
- Local Content different from Remote Content
- Check if a database is well installed
- Checking if the data already exsis in the wp database – custom plugin
- live site do not update after importing sql database
- Transforming an wp_options database array into a javascript obect?
- Share WordPress Database
- DB access blocked when initializing WP externally
- Site does not work right, pages not showing up, even for root admin
- ERROR: “Table Prefix” must not be empty
- How do you build a database-centric site in WP?
- WordPress: Interact with Database Query Data and Login
- Attach posts based on category and position
- Getting an error when trying to migrate to DV server from Grid with Media Temple [closed]
- Cant Connect to Database
- WordPress database connection failed, while mysql client is working [closed]