I'm trying to get key/value pair results from a query like PDO's FETCH_KEY_PAIR from a $wpdb query. The closest I found was the OBJECT_K output from get_results(). But that returns the key, but for the value it returns an array of values instead. How do I get it to return the proper key/value pair?
-
I believe you'll have to do that kind of pairing manually via PHP, but it's not hard..– Sally CJCommented Sep 20, 2020 at 7:26
-
@SallyCJ Yeah right now I do have a for loop after the call going through the array to redefine all the values, but it seems so pointless for someone whose used to working with PDO in PHP as this is something that just works.– Dan GoodspeedCommented Sep 20, 2020 at 8:07
Add a comment
|