Your problem is the constants OBJECT_K.
In the documentation you can read that this constant ensures that duplicate keys are discarded.
From the wordpress codex entry:
Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. Each row is an associative array (column => value, …), a numerically indexed array (0 => value, …), or an object. ( ->column = value ), respectively. With OBJECT_K, return an associative array of row objects keyed by the value of each row’s first column’s value. Duplicate keys are discarded.
Related Posts:
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- What are the common security flaws I need to look for? [closed]
- Making my plugin multi-site compatible
- dbDelta only creates the last table
- Creating 20,000 Posts or Pages using a .csv file?
- How does WordPress handle MySQL row lock errors?
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- Plugin Development sqlite or WordPress’ database
- Correct way to perform non-cacheable DB query
- Problem with creating tables for Plugin
- Prevent duplicate records in plugin table
- Change commission_status paid when withdraw_status vendor is completed
- How do I run SQL queries on a WordPress web page? [closed]
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- WordPress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- Insert data from .sql file in wordpress plugin
- WordPress Backend HA (Automatic failover)
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- Speeding SQL queries for a large database?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- WPDB: Update table
- Issue running db create table query from static method
- $wpdb update query in plugin only updating one column
- DB Query not working in Plugin
- Way to send multiple values for column to MySQL?
- WordPress plugin: efficient way to store large data
- Displaying data from another database
- Plugin generating unexpected output – on WP mysql dump import
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Can’t create tables with my plugin
- Integrating Custom Database with WordPress
- How to display results from a data table with an encrypted user id?
- JOIN and SUM different statement results (Mailster Database)
- How to get the custom field value using SQL query
- Memcaching recurring SQL Queries
- Need to know if my approach to designing a geneaology plug-in for wordpress makes sense
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- How to get database connection details without longing to cpanel in WordPress?
- Performing CRUD operations on front end in wordpress
- Display a number value from mysql query in WP
- How to securely controlling data without keeping it in postmeta?
- WordPress UPDATE queries on MySQL database stuck
- Using id to show item
- Resetting AUTO_INCREMENT primary key
- Re-writing MySQl query for execute faster
- Create Database Tables on Plugin Activation hook
- Create Array from data in the OPTIONS table
- Write mysql credentials in plugin
- Linking Plugin Files to WP
- how to search through plugin in wordpress cimy-user-extra-fields?
- How to display blog posts only authored by the administrator
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- How can I delete the options from DB when the plugin is deleted?
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- Redesigning Custom Post Type “Add New” page
- Is there any record of installed plugins in the database?
- Custom headers for the WordPress plugin directory
- plugin wants to update to wrong plugin
- How can I add a custom header to a custom template in a plugin without using the theme folders
- Trying to avoid including wp-load.php
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom values are not translated
- Make the plugin directory recognize new version numbers
- How to create popup same as wordpress popup feature
- How to make first_name and last_name required fields in user profile?
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Can we use a webservice with WordPress?
- WooCommerce get_price returning wrong price when used via ajax
- New User Form – Custom Menu Page
- Checking instances of scripts in wp_head
- How can I prevent my plugin go development trunk [closed]
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- How to create a code editor for my plugin .?
- Manually set a custom admin sub-menu selected?
- WordPress SQL Issue not returning correct reselts
- How to make custom plugin run on demand?
- WooCommerce – set session with new cart item meta when updating cart item quantity [closed]
- Using WordPress to build membership Page
- Set WordPress Transient Expiration via Variable Value
- Override plugin class which has namespace
- Quick press publish post hook
- I cannot include a file in my plugin settings page
- force logged in user to stay in the dashboard
- Clicking custom plugin admin menu redirects to “No Update Required” on live site
- The plugin generated 227 characters of unexpected output during activation. If you notice “headers already sent” messages
- 500 Internal server error wp_handle_upload_prefilter
- Installation failed, trying to install ANY plugin
- WordPress the_content Filter and GET Parameter
- Help Code Review – I need to write on .htaccess file from theme’s function.php
- Need to hide an element depending on date and post category
- How to add a handler for a button in plugin?
- Using Taxonomies with Vote It Up plugin chart [closed]
- wordpress last all added get meta value by post id
- Jquery post responses 500 error after some time and lastly an 503 error
- How to provide page_template path in custom plugin using WordPress