Works on local virtual server but not on actual web server

I have a small very standard type script to query a mysql db. The script works fine on my local LAMP server on my PC (running Ubuntu 10.04) but when I upload and execute the script on a server on the internet (Apache) it does not parse the php code only the html part,no error codes occur. If the problem is settings on the internet server I have no control over this aspect.The db table is not empty and does contain code.The internet server does parse other php code.
Script as follows:

Database Query <?php $username="darrel"; $password="abc"; $database="new"; mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM vehicles"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <?php $i=0; while ($i < $num) { $id=mysql_result($result,$i,"no"); $first=mysql_result($result,$i,"make"); $last=mysql_result($result,$i,"model"); $phone=mysql_result($result,$i,"colour"); $mobile=mysql_result($result,$i,"year"); ?> <?php $i++; } echo "
No Make Model Colour Year
<?php echo $no; ?> <?php echo $make; ?> <?php echo $model; ?> <?php echo $colour; ?> <?php echo $year; ?>
"; ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service