function _quiz_get_results in Quiz 5.2
Same name and namespace in other branches
- 5 quiz.module \_quiz_get_results()
- 6.6 quiz.module \_quiz_get_results()
- 6.2 quiz.module \_quiz_get_results()
- 6.3 quiz.module \_quiz_get_results()
- 6.4 quiz.module \_quiz_get_results()
- 6.5 quiz.module \_quiz_get_results()
- 7 quiz.module \_quiz_get_results()
1 call to _quiz_get_results()
- quiz_admin in ./
quiz.module - Quiz Admin.
File
- ./
quiz.module, line 1938
Code
function _quiz_get_results($nid = '', $uid = 0) {
$results = array();
$args = array();
$sql = "SELECT n.nid as nid,\n n.title as title,\n u.name as name,\n qnrs.result_id as result_id,\n qnrs.time_start,\n qnrs.time_end\n FROM {node} n, {quiz_node_properties} qnp, {quiz_node_results} qnrs, {users} u\n WHERE\n n.type = 'quiz'\n AND\n n.nid = qnp.nid\n AND\n qnrs.nid = qnp.nid\n AND\n u.uid = qnrs.uid";
if ($nid) {
$sql .= " AND qnrs.nid = %d";
$args[] = $nid;
}
if ($uid != 0) {
$sql .= " AND qnrs.uid = %d";
$args[] = $uid;
}
$sql .= " ORDER BY qnrs.result_id ASC";
$dbresult = db_query($sql, $args);
while ($line = db_fetch_array($dbresult)) {
$results[$line['result_id']] = $line;
}
return $results;
}