$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)?
- Fatal error: Call to undefined function mysql_connect()
- Query both first_name and last_name from wp_usermeta at the same time
- 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
- 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
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Need to get specific data from array
- Create an array from an array
- 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
- register_activation_hook isn’t adding table to DB
- Must Use Plugin Causing Query Error
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Ajax $wpdb not returning table data
- Parsing php string in jquery [closed]
- Is there a way to get 3+ dimensional array from a single MySql command
- Admin Options page. Save as Array
- PHP get the first post separately from array returned by wpdb->get_results()
- How can I add multiple ‘tax_query’ arrays via a loop?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- 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 adds “(wp_posts.ID = ‘0’)” so no results are returned
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- foreach loop still echoes 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 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
- WordPress Block developer from exporting Database via PHP
- How do I create a numbered list with PHP? [closed]
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- How to get the last category name of a child category?
- Warning: in_array() null given in PHP function
- email alert for product availability
- How do I prepare strings for insertions as values into a MySQL table?
- How can I split my query result in 2 arrays?
- 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
- Order a WP_Query by meta value where the value is an array
- Why won’t this wpdb get_results query return results?
- Using multiple variables to assign categories to an array
- Repeat a function with 24hrs gap for n number of days
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- WordPress low speed after migrating to new host
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Change upload URL by mime type
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- Insert data from form to database
- Make sticky post with FacetWP
- Rewrite SQL query as a prepared statement and use in foreach loop
- Prepared DB Query from _POST array
- Trouble with checked() for array of multiple checkboxes
- Conditional statement within WP SQL query
- WP_Post is not from correct array
- 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
- Exclude Post ID from Array Specified in Custom Field
- Adapting a php array to WordPress
- Splitting One Big WordPress Site into Multiple Small Sites
- MySQL database migration to WordPress
- Custom query_posts() parameter
- What is this mark for “? function()” [closed]
- Query Concatenation
- How to combine array info [closed]
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- Display total count of products in orders of a specific order status
- Grabbing value of input field inside of array
- How to set variable to specific field when querying
- How to get a database field value from a WordPress table? [closed]
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)