I am trying to access value from database in every 2 seconds and simultaneously 50 users.
My query looks as follows:
global $DB;
$curseId = $_REQUEST['crseId'];
if(isset($curseId)){
$qstndetails = $DB->get_records_sql('SELECT * FROM {questions} WHERE courseid=? ORDER BY id DESC LIMIT 0,1',array($curseId));
$qstnval = array_values($qstndetails);
}
Because of heavy load my data is not loading and I am continuously fetching it in every 2 seconds.
How can I close data base connection after fetching record?
In case of Java
we can close object of Connection class. Suppose con is the object then we close connection after fetching data as con.close();
.
Is there any way to close database connection after fetch data in Moodle
??
Moodle version - 2.9.1