<?php
// /elms/lecturer/assessments/_probe.php
declare(strict_types=1);
@date_default_timezone_set('Asia/Colombo');
ini_set('display_errors','1'); error_reporting(E_ALL);
function row($k,$v){ echo "<tr><th style='text-align:left;padding:6px;border:1px solid #ddd'>$k</th><td style='padding:6px;border:1px solid #ddd'>$v</td></tr>"; }

$paths = [
  __DIR__.'/../../includes/db.php',
  __DIR__.'/../includes/db.php',
  __DIR__.'/../../includes/db_boot.php',
];
$found = 'none';
foreach($paths as $p){ if(is_file($p)){ $found=$p; require_once $p; break; } }

$okDb = isset($mysqli) && $mysqli instanceof mysqli;
if ($okDb) { $mysqli->query("SET time_zone = '+05:30'"); }

function exists(mysqli $db,$t){
  $st=$db->prepare("SHOW TABLES LIKE ?"); $st->bind_param('s',$t); $st->execute(); $st->store_result(); $ok=$st->num_rows>0; $st->close(); return $ok;
}
?><!doctype html><meta charset="utf-8"><title>Lecturer probe</title>
<h2>Lecturer probe</h2>
<table style="border-collapse:collapse">
<?php
row('db include',$found);
row('mysqli ok',$okDb?'yes':'no');
if($okDb){
  foreach(['lms_assessments','lms_submissions','studentss','lms_lecturer_assignments'] as $t){
    row("table $t", exists($mysqli,$t)?'yes':'no');
  }
  $r=$mysqli->query("SELECT COUNT(*) c FROM lms_submissions"); if($r){ $c=$r->fetch_assoc()['c']; row('submissions rows',(int)$c); }
}
?>
</table>
<p style="color:#555">If anything is “no”, that’s your 500. Fix include path or create missing tables/columns.</p>
