the shortcode given below returns only the first value:
function completed_quiz(){
global $wpdb;
$current_user = wp_get_current_user();
$userID = $current_user->ID;
$fetch22 = $wpdb->get_results("MySQL Query");
foreach($fetch22 as $item){
return "Quiz ID: $item->quiz_id Percentage: $item->result <br>";
}
}
add_shortcode('show_completed_quiz', 'completed_quiz');
However if I use "echo" it gives all the values. What am I missing here?