diff --git a/main/exercice/hotpotatoes.lib.php b/main/exercice/hotpotatoes.lib.php index 5da6d8240c..6ef8ab9f43 100644 --- a/main/exercice/hotpotatoes.lib.php +++ b/main/exercice/hotpotatoes.lib.php @@ -80,11 +80,17 @@ function GetQuizName($fname,$fpath) { * @param string File path * @return string Comment from the database record */ -function GetComment($path) { +function GetComment($path,$course_code='') { global $dbTable; + + if (!empty($course_code)) { + $course_info = api_get_course_info($course_code); + $dbTable = Database::get_course_table(TABLE_DOCUMENT,$course_info['dbName']); + } $path = Database::escape_string($path); - $query = "select comment from $dbTable where path='$path'"; + $query = "select comment from $dbTable where path='$path'"; $result = api_sql_query($query,__FILE__,__LINE__); + while ($row = mysql_fetch_array($result)) { return $row[0]; }