if (!empty($level)){
if (!empty($subject_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id AND level LIKE $level");
if (!empty($category_id) AND empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id AND category_id = $category_id AND level LIKE $level");
if (!empty($category_id) AND !empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id AND category_id = $category_id AND subcategory_id = $subcategory_id AND level LIKE $level");
}
if (empty($level)){
if (!empty($subject_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id");
if (!empty($category_id) AND empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id AND category_id = $category_id");
if (!empty($category_id) AND !empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $subject_id AND category_id = $category_id AND subcategory_id = $subcategory_id");
}
if (!empty($level)){
if (!empty($subject_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id AND level LIKE $level");
if (!empty($category_id) AND empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id AND category_id = $category_id AND level LIKE $level");
if (!empty($category_id) AND !empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id AND category_id = $category_id AND subcategory_id = $subcategory_id AND level LIKE $level");
}
if (empty($level)){
if (!empty($subject_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id");
if (!empty($category_id) AND empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id AND category_id = $category_id");
if (!empty($category_id) AND !empty($subcategory_id))
$result = mysql_query("SELECT * FROM question WHERE subject_id = $user AND subject_id = $subject_id AND category_id = $category_id AND subcategory_id = $subcategory_id");
}