dozent_get_question_correct_options( int $question_id, bool $first = false )

Get all correct questions options


Parameters

$question_id

(int) (Required) Question ID

$first

(bool) (Optional) Return only first item or all

Default value: false


Return

(array|object|void|null)


Source

File: includes/quiz-functions.php

	function dozent_get_question_correct_options( $question_id, $first = false ) {
		global $wpdb;

		$sql = "SELECT * FROM {$wpdb->dozent_quiz_question_options} 
			WHERE question_id = {$question_id} 
			AND is_correct = 1 ORDER BY sort_order ASC ;";

		if ( $first ) {
			return $wpdb->get_row( $sql );
		}

		return $wpdb->get_results( $sql );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.