Hot answers tagged

2

Going to take a wild stab, but ARRAY_A will return an associative array You are then trying to access this associative array as an object Simple change: foreach($results as $result){ echo $result->Name; } To: foreach($results as $result){ echo $result['Name']; } and the error should go away!


2

You have a problem with your query which is you can't use GROUP BY and ORDER BY before WHERE replace FROM tablename GROUP BY submit_time ORDER BY submit_time DESC with FROM tablename This is your query $results = $wpdb->get_results( 'SELECT DATE_FORMAT(FROM_UNIXTIME(submit_time), "%b %e, %Y %l:%i %p") AS Submitted, ...


1

You could use wp_parse_id_list() to sanitize your comma seperated list of post IDs. It's defined as: function wp_parse_id_list( $list ) { if ( !is_array($list) ) $list = preg_split('/[\s,]+/', $list); return array_unique(array_map('absint', $list)); } where we can see that it returns unique array values as well. Note that absint() is ...



Only top voted, non community-wiki answers of a minimum length are eligible