Stuck on site.php after editing text on the front page....ahhhhh

Stuck on site.php after editing text on the front page....ahhhhh

by Chris Neaves -
Number of replies: 5

Site has been up and running beautifully with 1.0.9 since it was released, UNTIL yesterday when I went to change some of the text on the front login page using the text editor, I was doing nothing fancy with the php's or css files... just using moodle normally

Now I am stuck on site.php and cant get past it.

I have read every forum I can find here and done every combination of changes except to http.conf files and server php settings as I dont have access to these, all to no avail.

Now I did set up a totally new moodle site from scratch with a new prefix on the database tables and it worked. So there appears to be nothing wrong with the htaccess file or server settings, could it be a corrupted file in a directory or a problem with the database that is causing it to get stuck at site.php?? (site is nacgroundschool.com/classroom )

help appreciated as students are pestering me for access...

thanks in advance

Chris

 

 

Average of ratings: -
In reply to Chris Neaves

Re: Stuck on site.php after editing text on the front page....ahhhhh

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK, this stuff shouldn't happen (and in future there will be more checks on database wierdness)... but try this:

1. Edit lib/datalib.php

2. Look for the function get_record_sql

3. Change this line:

$rs = $db->Execute($sql);

to

$rs = $db->Execute("$sql LIMIT 1");
In reply to Martin Dougiamas

Re: Stuck on site.php after editing text on the front page....ahhhhh

by Chris Neaves -

IT WORKS!! biggrin.gifbiggrin.gifbiggrin.gif

Thanks for the quick response, although the initial filename threw me a bit but I see you amended it to datalib.php

Thanks again

In reply to Martin Dougiamas

Re: Stuck on site.php after editing text on the front page....ahhhhh

by David González Zamora -

confuso

Hi,

I´m trying to isntall the last version of moodle and I´ve the same problem. But, when I tried to edit that file, I can´t see "$rs = $db->Execute($sql);"

What can I do to continue with my installation?

Thanks

In reply to David González Zamora

Re: Stuck on site.php after editing text on the front page....ahhhhh

by Tom Murdock -
It should be in line 261 of that file.
In reply to Tom Murdock

Re: Stuck on site.php after editing text on the front page....ahhhhh

by David González Zamora -

Line 261 is in another function.

I modify this code:

-----------------------------------------------------

function get_record_sql($sql) {

    global $db, $CFG;

    if (isset($CFG->debug) and $CFG->debug > 7) {    // Debugging mode - don't use limit
       $limit = "";
    } else {
       $limit = " LIMIT 1";    // Workaround - limit to one record
    }

    if (!$rs = $db->Execute("$sql LIMIT 1")) {
        if (isset($CFG->debug) and $CFG->debug > 7) {    // Debugging mode - print checks
            notify( $db->ErrorMsg() . "<br /><br />$sql$limit" );
        }
        return false;
    }

    if (!$recordcount = $rs->RecordCount()) {
        return false;                 // Found no records
    }

    if ($recordcount == 1) {          // Found one record
        return (object)$rs->fields;

    } else {                          // Error: found more than one record
        notify("Error:  Turn off debugging to hide this error.");
        notify("$sql$limit");
        if ($records = $rs->GetAssoc(true)) {
            notify("Found more than one record in get_record_sql !");
            print_object($records);
        } else {
            notify("Very strange error in get_record_sql !");
            print_object($rs);
        }
        print_continue("$CFG->wwwroot/admin/config.php");
    }
}
-----------------------------------------------------

I can go to the next step, but now I´m stucked on edit.php

sad