One more for the pot:
$wpdb->get_col
can be used to return a “single dimensional” array of all values set for “sleeps”
global $wpdb;
$values = $wpdb->get_col( "SELECT meta_value FROM wp_postmeta WHERE meta_key = 'sleeps'" );
echo implode(',', array_unique($values) );
Related Posts:
- Fatal error: Call to undefined function mysql_connect()
- Can i use php sql functions instead of $wpdb?
- Query both first_name and last_name from wp_usermeta at the same time
- How to validate WordPress generated password in DB using PHP?
- How to get the list of WooCommerce product image of a certain category from database?
- Custom query to get post names beginning with a digit
- How to add query vars with paginated URLs?
- Changing user_nicename
- WordPress will not operate correctly
- How to Join two tables from separate databases within WordPress
- tag search using WP_Query
- simple wordpress ajax plugin not working when not logged in
- Install will not load: PHP does not have MYSQL installed
- Insert post without actions/hooks
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- Import 10,000 Users into WordPress WITH a specific ID for each user
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to get the post_id from postmeta
- Sortable admin column for one meta key with three possible meta values
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Styling images coming from another blog
- register_activation_hook isn’t adding table to DB
- mysqli_real_connect() – authentication method unknown to the client Warnings
- Do I need to prepare query before get_results(), get_row() and get_var()?
- 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
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- Is there a way to get 3+ dimensional array from a single MySql command
- Custom Plugin For Converting CSV To MySQL
- Checking for new message using AJAX and PHP. Server overload?
- Can’t get wp_insert_post to work
- I want to select the from values from database in WordPress? [closed]
- mysql query from wordpress page using custom table
- User management system similar to wordpress one?
- Importing Geo data into wordpress database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- wp query foreach deleting record returning only first or last item
- 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
- $wpdb->wp_users returning empty value for
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- WordPress Block developer from exporting Database via PHP
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- Force Users To Relogin
- email alert for product availability
- Basic wpdb update question
- A $_POST should occur when submit form but is not?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- How do I prepare strings for insertions as values into a MySQL table?
- Using CFDB7 vs Custom MySQL Database [closed]
- add category to posts with tag wordpress
- How can I Use 2 databases with one WordPress install
- Why won’t this wpdb get_results query return results?
- Adding data to custom wordpress database table
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- Removal of all posts content in bulk, keeping the posts itself
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- How to store checkbox data for individual users?
- WordPress low speed after migrating to new host
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- Usermeta data unserialize, extract and display in table in WordPress
- I can’t separate the array by commas
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- How can i limit the number of posts to the most recent 6 in my query?
- Change upload URL by mime type
- Insert data from form to database
- I want show only data for today
- Rewrite SQL query as a prepared statement and use in foreach loop
- Prepared DB Query from _POST array
- Include a custom field in mysql query
- Conditional statement within WP SQL query
- WordPress upload images not displaying
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- Insert double entry in DB
- Splitting One Big WordPress Site into Multiple Small Sites
- 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
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- Display total count of products in orders of a specific order status
- Putting form result in my database
- How can I update a value of a field depending on outside source?
- running an existing WordPress site from Visual Studio Code?