set up a test file index.js
containing only:
alert('boo!');
Test that works with a hard-coded version of your js include line.
Prove it works.
Then add your PHP version.
PHP spits out the whole stream to the browser, so no, its nothing to do with PHP - probably something to do with relative/absolute paths in the SRC of the js defn - hence the incremental development idea above should help identify where you are going wrong. Divide and conquer.
The code you showed means there is no point in having an else, so you could shorten it to:
<?php
if ($row['jstype'] == 'myanswer')
echo '<script type="text/javascript" src="js/index.js"></script>';
?>
Depending on how many ELSE conditions you actually do need, show them and its possible someone can suggest better ways of writing it.