Fixing SQL error

skala
Julio Montoya 13 years ago
parent 9d400724a1
commit 4357a16269
  1. 14
      main/exercice/hotpotatoes.lib.php

@ -76,12 +76,14 @@ function GetComment($path, $course_code = '') {
global $dbTable;
$course_info = api_get_course_info($course_code);
$path = Database::escape_string($path);
$query = "SELECT comment FROM $dbTable WHERE c_id = {$course_info['real_id']} AND path='$path'";
$result = Database::query($query);
while ($row = Database::fetch_array($result)) {
return $row[0];
if (!empty($course_info) && !empty($path)) {
$query = "SELECT comment FROM $dbTable WHERE c_id = {$course_info['real_id']} AND path='$path'";
$result = Database::query($query);
while ($row = Database::fetch_array($result)) {
return $row[0];
}
}
return '';
return null;
}
/**
@ -97,7 +99,7 @@ function SetComment($path, $comment) {
$course_id = api_get_course_int_id();
$query = "UPDATE $dbTable SET comment='$comment' WHERE $course_id AND path='$path'";
$result = Database::query($query);
return "$result";
return $result;
}
/**

Loading…
Cancel
Save