Query works in phpmyadmin but not with $wpdb
-
Hello !
I am trying to retrieve all user meta (in columns) for each users (in rows).
I build (not without pain) this query that is working in phpmyadmin :
SET group_concat_max_len=16384; SET @sql = NULL; SELECT GROUP_CONCAT( DISTINCT CONCAT( 'MAX( IF ( M.meta_key = ''', meta_key, ''', M.meta_value, NULL)) AS `', meta_key, '`' ) ) INTO @sql FROM wp_usermeta; SET @sql = CONCAT( ' SELECT *, ', @sql, ' FROM wp_users as U, wp_usermeta as M WHERE U.id = M.user_id GROUP BY U.id ' ); PREPARE stmt FROM @sql; EXECUTE stmt;
But when I execute it with $wpdb->get_results, it returns an empty array.
Anyone can help ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Query works in phpmyadmin but not with $wpdb’ is closed to new replies.