I seem to be having trouble with my php code. I have constructed the query using phpMyAdmin where it works without any problems. However, once I insert the sql query into this php code it does not seem to work at all. PHP: <?php mysql_connect("127.0.0.1", "root", "password"); mysql_select_db("transport"); $q = mysql_query("SELECT * FROM `tube` WHERE `code` = 'B'"); while ($row = mysql_fetch_assoc($q)) $output = $row; print(json_encode($output)); mysql_close(); ?> I keep getting the following error message when I try and execute the php script using my web browser. I would just like it known that the mySQL database and the php script are both located on an external server. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request. Any help regarding the coding would be helpful.