The 500 error is generic error hosts will use to mask the actual error that is occurring.
normally, turning on error reporting:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
should show the true error, I added that code at line but it is not showing the true error. Sometimes hosts will set the server so that the error reporting cannot be changed using PHP code, looks like that is the case with this host. You will need to contact the host to have them look into the error logs to find the true error that is occurring. once i know what the true error says i can troubleshoot.
one this I see is that the connection, query and the table you are querying all use the same name:
test
you should use unique names for the connection and recordset.