it has happened to me lately that my site delays in loading between 0.01 and 5 seconds in loading a page, I would like to know if I am doing something wrong in the code, since I do not understand why it happens.
Fatal error: Uncaught Error: Call to a member function prepare () on null in /usr/www/reactapp/ap/assets/classes/class.db.php:25 Stack trace: # 0 / usr / www / reactapp / ap / thread.php (19): Database-> query ('SELECT * FROM t ...') # 1 {main} thrown in /usr/www/reactapp/ap/assets/classes/class.db .php on line 25
Verifying the lines shown above:
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
require 'assets/steam/steamauth.php';
include_once( 'assets/classes/class.connect.php' );
include_once( 'assets/classes/class.user.php' );
include_once( 'assets/classes/class.forum.php' );
include_once( 'assets/classes/class.markdown.php' );
$id = $_REQUEST[ 'id' ];
if ( $id == NULL )
{
$id = 1;
}
$db = new Database();
$db->query( 'SELECT * FROM thread WHERE idthread = :id' );
My question is what may be causing this delay between requests? not much information is requested from the server.
Thanks in advance,
PS: The error occurs randomly.