include_once("php_includes/db_conx.php"); require("php_includes/function.php"); $search = $_POST['search']; $type = $_POST['type']; if($type == "" AND $search !=""){ $case = 1; } if($type != "" AND $search ==""){ $case = 2; } if($type != "" AND $search !=""){ $case = 3; } switch ($case) { case 1: $sql = "SELECT * FROM clc_doc where doc_title LIKE '%$search%' or keyword LIKE '%$search%' or doc_description LIKE '%$search%' ORDER BY year DESC" ; $docResult = $db_conx->query($sql); if($docResult->num_rows > 0 ) { while($row = $docResult->fetch_assoc()){ $doc[] = $row; } } break; case 2: $sql = "SELECT * FROM clc_doc where doc_type = $type ORDER BY year DESC"; $docResult = $db_conx->query($sql); if($docResult->num_rows > 0 ) { while($row = $docResult->fetch_assoc()){ $doc[] = $row; } } break; case 3: $sql = "SELECT * FROM clc_doc where (doc_title LIKE '%$search%' or keyword LIKE '%$search%' or doc_description LIKE '%$search%') and doc_type = $type ORDER BY year DESC"; $docResult = $db_conx->query($sql); if($docResult->num_rows > 0 ) { while($row = $docResult->fetch_assoc()){ $doc[] = $row; } } break; default: $sql = "SELECT * FROM clc_doc ORDER BY year DESC"; $docResult = $db_conx->query($sql); if($docResult->num_rows > 0 ) { while($row = $docResult->fetch_assoc()){ $doc[] = $row; } } } ?>
Categories > All Categories
0 results found. ( if($type == 1) {echo "Publications";}; if($type == 2) {echo "Documents";}; if($type == 3) {echo "Presentations";}; if($type == "4") {echo "Others";}; if($type == "") {echo "All Types";}; ?>)
The search document was not found in database. Please try again!