function _quiz_get_results in Quiz 6.2
Same name and namespace in other branches
- 5.2 quiz.module \_quiz_get_results()
- 5 quiz.module \_quiz_get_results()
- 6.6 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.admin.inc - Quiz Admin.
File
- ./
quiz.module, line 1660 - Quiz Module
Code
function _quiz_get_results($nid = '', $uid = 0) {
$results = array();
$args = array();
$sql = "SELECT n.nid, n.title, u.name, qnrs.result_id, qnrs.time_start, qnrs.time_end\n FROM {node} n\n INNER JOIN {quiz_node_properties} qnp\n INNER JOIN {quiz_node_results} qnrs\n INNER JOIN {users} u\n WHERE n.type = 'quiz'\n AND n.nid = qnp.nid\n AND qnrs.nid = qnp.nid\n AND 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;
}