Example #1
0
function get_arr_rowChoice($db, $idQ)
{
    if (!isset($_SESSION['map_QC'])) {
        $_SESSION['map_QC'] = array();
    }
    if (isset($_SESSION['map_QC'][$idQ])) {
        return $_SESSION['map_QC'][$idQ];
    } else {
        $result = $db->query("select * from oes_Choice where Question = {$idQ}");
        $map_QC = fetch_columns($result);
        mysql_free_result($result);
        return $_SESSION['map_QC'][$idQ] = $map_QC;
    }
}
Example #2
0
 function getColumns($columns, $table)
 {
     $result = $this->query("select {$columns} from `{$table}` order by {$columns}");
     $ret = fetch_columns($result);
     mysql_free_result($result);
     return $ret;
 }
Example #3
0
</HEAD>

<?php 
$db = new Database(DB_HOST, DB_USER, DB_PASS);
$db->selectDatabase(DB_NAME);
$res = null;
if (isset($_POST['submit'])) {
    $search = $_POST['search'];
    $query = "SELECT oes_Question.ID, Text, Name FROM oes_Question join oes_Subject on oes_Subject.ID = oes_Question.Subject where Newer is null and Text like '%" . $search . "%'";
    if (($subject = $_POST['subject']) > 0) {
        $query .= " AND Subject = " . $subject;
    }
    $query .= ' limit 10';
    try {
        $result = $db->query($query);
        $res = fetch_columns($result);
        mysql_free_result($result);
    } catch (Exception $e) {
        ?>
				<center>Xảy ra lỗi trong khi tìm kiếm.</center>
				<center>Xin hãy kiểm tra thông tin đã nhập.</center>
				<center><button onClick='history.back()'>Trở lại</button></center>
			<?php 
        echo $e->getMessage();
        return -1;
    }
}
?>

<BODY>
<div align=center>