Manage Question Pool"; ?>

 

Add a new question

 

"; echo "";//empty cell echo " ";//print the category echo "";// echo ""; // building the query $query = "SELECT * FROM tbl_questions WHERE "; for ($i=1; $i <= $q_category_id; $i++){ if ($i < $q_category_id){ $query .= ( "category_" . $i . " = 0 AND "); } else { $query .= ( "category_" . $i . " = 1"); } }//end of the for loop //end of building the query // now get all the questions that should be displayed under that category, using the query we built $result2 = mysql_query($query, $connection) or die("could not query tbl_questions
" . mysql_error()); // print the question and the categories associated with it while ($row2 = mysql_fetch_array($result2)){ $question_id = $row2['question_id']; $question_text = $row2['question_text']; $cat_1 = $row2['category_1']; $cat_2 = $row2['category_2']; $cat_3 = $row2['category_3']; $cat_4 = $row2['category_4']; $cat_5 = $row2['category_5']; $cat_6 = $row2['category_6']; $cat_7 = $row2['category_7']; $cats_to_display = ""; if ($cat_1){ $cats_to_display .= "1 "; } if ($cat_2){ $cats_to_display .= "2 "; } if ($cat_3){ $cats_to_display .= "3 "; } if ($cat_4){ $cats_to_display .= "4 "; } if ($cat_5){ $cats_to_display .= "5 "; } if ($cat_6){ $cats_to_display .= "6 "; } if ($cat_7){ $cats_to_display .= "7 "; } echo ""; echo ""; echo ""; } // blank row between categories echo ""; }// end of the while loop going through each category //end of table echo "
Question Text Categories
$q_category_id. $q_category_title
"; // find out whether the question is in use, and display "in use" if so if (! in_use($question_id)){ echo "delete"; } else{ echo"in use"; } echo "$question_text$cats_to_display



"; ?>

 

 

Return to Main Menu

 

" . mysql_error()); $in_use = mysql_result($result, 0); if ($in_use > 0){ return 1; } else{ return 0; } } ?>