Updated DB insert logic

Updated the database insert logic in result.php.