It sounds like you know more than me anyway! :)
I don't know what db class that is, but is there an error function in there?
Maybe:
[code]
$db->query("INSERT INTO {$tbl_prefix}webs (tid, school, subject, theme) VALUES('$_SESSION[id]', '$school', '$subject', '$theme')");
if (!$db->error())
{...