Added a second parameter in case the table is in blank

skala
Arthur Portugal 17 years ago
parent 0aa8a8f71b
commit 538291644a
  1. 10
      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];
}

Loading…
Cancel
Save