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 * @param string File path
* @return string Comment from the database record * @return string Comment from the database record
*/ */
function GetComment($path) { function GetComment($path,$course_code='') {
global $dbTable; 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); $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__); $result = api_sql_query($query,__FILE__,__LINE__);
while ($row = mysql_fetch_array($result)) { while ($row = mysql_fetch_array($result)) {
return $row[0]; return $row[0];
} }

Loading…
Cancel
Save