]> git.mjollnir.org Git - moodle.git/commitdiff
We are expecting multiple records, but in debug mode, it gives this error:
authorethem <ethem>
Thu, 23 Nov 2006 16:22:39 +0000 (16:22 +0000)
committerethem <ethem>
Thu, 23 Nov 2006 16:22:39 +0000 (16:22 +0000)
Error: Turn off debugging to hide this error.

SELECT id FROM enrol_authorize WHERE userid = '3' AND courseid = '2' AND status=0(with limits 0, 100)

Very strange error in get_record_sql !

enrol/authorize/localfuncs.php

index 0546fcc63642312d4d8ae9c5d81ef6cdb057a334..7929f598803fc00c75ecb2f914c554235e5e58fb 100644 (file)
@@ -31,9 +31,7 @@ function prevent_double_paid($course)
 {
     global $CFG, $SESSION, $USER;
 
-    $sql = "SELECT id FROM {$CFG->prefix}enrol_authorize
-            WHERE userid = $USER->id
-              AND courseid = $course->id ";
+    $sql = "SELECT id FROM {$CFG->prefix}enrol_authorize WHERE userid = '$USER->id' AND courseid = '$course->id' ";
 
     if (empty($CFG->an_test)) { // Real mode
         $sql .= 'AND status IN('.AN_STATUS_AUTH.','.AN_STATUS_UNDERREVIEW.','.AN_STATUS_APPROVEDREVIEW.')';
@@ -42,9 +40,9 @@ function prevent_double_paid($course)
         $sql .= 'AND status='.AN_STATUS_NONE;
     }
 
-    if ($rec = get_record_sql($sql)) {
+    if ($recid = get_field_sql($sql)) {
         $a = new stdClass;
-        $a->orderid = $rec->id;
+        $a->orderid = $recid;
         $a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$a->orderid";
         redirect($a->url, get_string("paymentpending", "enrol_authorize", $a), '10');
         return;