Changeset 1327631
- Timestamp:
- 01/13/2016 04:28:00 PM (10 years ago)
- File:
-
- 1 edited
-
mtouch-quiz/trunk/show_quiz.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mtouch-quiz/trunk/show_quiz.php
r638075 r1327631 12 12 $GLOBALS['wpframe_plugin_name'] = basename(dirname(__FILE__)); 13 13 $GLOBALS['wpframe_plugin_folder'] = $GLOBALS['wpframe_wordpress'] . '/wp-content/plugins/' . $GLOBALS['wpframe_plugin_name']; 14 $rand_seed = rand(); 14 15 15 16 $quiz_options = $wpdb->get_row($wpdb->prepare("SELECT name,description,answer_mode,single_page,show_hints,show_start,show_final,multiple_chances,final_screen,random_questions,random_answers FROM {$wpdb->prefix}mtouchquiz_quiz WHERE ID=%d", $quiz_id)); … … 296 297 297 298 if( $random_questions == 1 && $input_number_questions > 0 ) { // Select questions randomly 298 $all_question = $wpdb->get_results($wpdb->prepare("SELECT ID,question,explanation, point_value FROM {$wpdb->prefix}mtouchquiz_question WHERE quiz_id=%d AND ID>=$first_id_value AND ID<=$last_id_value ORDER BY RAND( ) LIMIT 0, $input_number_questions", $quiz_id));299 $all_question = $wpdb->get_results($wpdb->prepare("SELECT ID,question,explanation, point_value FROM {$wpdb->prefix}mtouchquiz_question WHERE quiz_id=%d AND ID>=$first_id_value AND ID<=$last_id_value ORDER BY RAND($rand_seed) LIMIT 0, $input_number_questions", $quiz_id)); 299 300 } elseif( $random_questions != 1 && $input_number_questions > 0 ) { // Select questions in order 300 301 $all_question = $wpdb->get_results($wpdb->prepare("SELECT ID,question,explanation, point_value FROM {$wpdb->prefix}mtouchquiz_question WHERE quiz_id=%d AND ID>=$first_id_value AND ID<=$last_id_value ORDER BY ID LIMIT 0, $input_number_questions", $quiz_id)); // Not random … … 430 431 echo "</colgroup>"; 431 432 if ( $random_answers == 1 ) { 432 $dans = $wpdb->get_results("SELECT ID,answer,correct,hint FROM {$wpdb->prefix}mtouchquiz_answer WHERE question_id={$ques->ID} ORDER BY RAND( )"); // This will randomize the question answer order433 $dans = $wpdb->get_results("SELECT ID,answer,correct,hint FROM {$wpdb->prefix}mtouchquiz_answer WHERE question_id={$ques->ID} ORDER BY RAND($rand_seed)"); // This will randomize the question answer order 433 434 } else { 434 435 $dans = $wpdb->get_results("SELECT ID,answer,correct,hint FROM {$wpdb->prefix}mtouchquiz_answer WHERE question_id={$ques->ID} ORDER BY sort_order");
Note: See TracChangeset
for help on using the changeset viewer.