$wpdb->get_results has a second parameter that lets you specify what kind of return value you want:
For example:
$data = $wpdb->get_results( $query, ARRAY_A );
Here you get an associative array back.
Related Posts:
- Grouping posts by a custom meta value
- MySQL Query Returns Array () In Shortcode
- Convert a column of a table containing an Array as response in HTML
- How to insert multiple rows and columns in database using array
- How to display MySQL table data which is stored as an array?
- How can get all users by current user meta (array)?
- 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]
- How i can obtain all the post meta for a specific post as an array?
- Alter required message using comment form api
- multiple where condition in result query
- Advanced Custom Fields – display label and value only if value entered
- meaning of (array)function()
- Multiple meta_key in one global $wpdb;
- wp_force_remove_style’ not found
- Custom array from a query only write the last row of the query
- WordPress member notification
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Can’t Query Custom Table Using $wpdb Method
- How can I access string value in an array?
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- How to use if statement in an array? [closed]
- How to array only one key from another array
- WordPress Block developer from exporting Database via PHP
- Filtering a function’ output for a new continued function
- Get html data with javascript to php array and store to wordpress database
- $wpdb returns duplicate posts
- Update postmeta after theme switch
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Mixing variables into an array when inserting values
- Location of core code for database connection and get_header
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- Make a database query using WordPress
- How to use array in function to get only value I want
- Error while setting role
- Get categories names as an array to use it in theme settings
- Force Users To Relogin
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- WordPress Custom SQL Table with UserID Filter for results
- How to get the last category name of a child category?
- How to say if meta_value is greater than 0 in an array?
- How to use two meta_compare in an array?
- Warning: in_array() null given in PHP function
- Most commented posts by time period (last 12h, last 24h and etc)
- Use $wpdb or other PHP script method to find/replace in WP database
- email alert for product availability
- Foreach loop inside an array_merge
- How can I add a new row in a separate database when someone registers via WordPress?
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Loop over Array and get the distinct ids
- Basic wpdb update question
- How to access or parse key/values that have “string”
- If Array Values Match Another Array’s Values, Then
- Hide posts if user is added to it WP_query
- Remove empty terms from array, sort alphabetically, update back to repeating field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Only show first image in foreach loop
- Conditional multidimensional arrays and array_map
- I can’t update my data through $wpdb
- A $_POST should occur when submit form but is not?
- Custom route and query
- Output: “Array”
- How can I get all values from my array in a loop in php? [closed]
- How to unserialize data from MySQL
- How to use mysql LIKE with wpdb?
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- Pull MySQL data from multiple tables and merge into 1 PHP array
- I’m unable to call img path using single quotes in an array?
- Filter by field with array value in ACF on WP REST API
- extract serialized array to use for wp-query
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- get users search not working with array
- WordPress WP_Query without query GET parameters
- How do I prepare strings for insertions as values into a MySQL table?
- Known Issues in WordPress When Upgrading PHP to ver 7
- Comapare get_user_meta value
- How can get all users by current user meta?
- Using CFDB7 vs Custom MySQL Database [closed]
- Get the id of all images in a post
- Output category list inside array
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Multidimensional Array
- How to use AJAX in WordPress in MYSQL query?
- Separate array output into a
- add category to posts with tag wordpress
- array_rand not working correctly?
- How can I Use 2 databases with one WordPress install
- Get css class of menu item in custom menu structure
- Use variable in SQL statement
- Using wordpress function to retrieve data
- Dynamically adding filters