aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl17
1 files changed, 11 insertions, 6 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index ddc3476..f534c84 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -795,23 +795,28 @@ proc htmlFooter {permission_list} {
puts "</div>"
}
-
-proc SelectColValue4User { colname user } {
+proc SelectColvalueFromTable { table column_of_interest col row_value } {
+ # select value of 'column_of_interest' from 'table' where 'col'='row_value'
set value {}
- set eval_str "SELECT \"$colname\" FROM GradesTable where UserName=\"$user\""
+ set eval_str "SELECT \"$column_of_interest\" FROM \'$table\' WHERE \"$col\"=\"$row_value\""
set err [catch {
db eval $eval_str v {
- set value $v($colname)
+ set value $v($column_of_interest)
}
} errStat ]
if { $err } {
- htmlErrorMsg $errStat
- dbg "the following error happen: $errStat" 3
+ set msg_text "the following error happen in proc SelectColvalueFromTable while selecting from table $table $errStat"
+ htmlErrorMsg $msg_text
+ dbg $msg_text 3
set $value {}
}
return $value
}
+proc SelectColValue4User { colname user } {
+ return [SelectColvalueFromTable GradesTable $colname UserName $user]
+}
+
proc ClassInfoHtml {} {
set CourseTitle [SelectItemFromCourseInfoTable course_title]
set CourseYear [SelectItemFromCourseInfoTable course_year]