Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-25411

Error reading from database Debug: Incorrect syntax near the keyword 'FROM'. SELECT TOP 11 FROM mdl_role_assignments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • 2.0
    • None
    • Microsoft SQL
    • MOODLE_20_STABLE

      Description: when logged in to Moodle 2 and a list of users is displayed. If you click on your own profile all works correctly
      e.g. user/profile.php?id=3
      However if you click on someone else's id
      user/profile.php?id=4
      then this results in an error.

      The following error was obtained on I.E 8 on the web server

      Default exception handler: Error reading from database Debug: Incorrect syntax near the keyword 'FROM'. SELECT TOP 11 FROM mdl_role_assignments WHERE userid = ? AND roleid IN (3) [array ( 0 => '4', )] * line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown * line 247 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end() * line 699 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end() * line 1540 of \lib\dml\moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql() * line 825 of \lib\accesslib.php: call to moodle_database->record_exists_sql() * line 3287 of \lib\navigationlib.php: call to has_coursecontact_role() * line 3211 of \lib\navigationlib.php: call to settings_navigation->generate_user_settings() * line 2586 of \lib\navigationlib.php: call to settings_navigation->load_user_settings() * line 583 of \lib\pagelib.php: call to settings_navigation->initialise() * line 599 of \lib\pagelib.php: call to moodle_page->magic_get_settingsnav() * line 117 of \user\profile.php: call to moodle_page->__get()

      This shows that it is a SQL syntax error as
      SELECT TOP 11 FROM mdl_role_assignments
      is wrong and will not work on any SQL database (tested on MS SQL Server and MySQL)

      It should read
      SELECT TOP 11 * FROM mdl_role_assignments (or similar)

            nebgor Aparup Banerjee
            mm447 Michael Mulvihill
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.