开发者

php works on wamp but not on 000webhost

I have a php file that works perfectly with WAMP server, but when Im trying the 000webhost server I get errors. i.e. error on line 11 at column 1: Extra content at the end of the document. however under the error I get the right answer to the query, but not in the format I asked for. can anyone help? here is the code:

开发者_JS百科
<?php   
mysql_connect("localhost","root",""); 
mysql_select_db("ataxi");
$src= $_GET['src'];
$dest = $_GET['dest'];
$day= $_GET['day'];
$hour = $_GET['hour'];
$luggage= $_GET['luggage']; 
$query="SELECT price, estime FROM prices WHERE src='$src' and dest='$dest' and day='$day' and hour='$hour' and luggage=$luggage;"; 
$result= mysql_query($query) or die("error:".$query);
header('Content-type: application/xml; charset="utf-8"',true);
echo "<table>\n"; 
while ($row= mysql_fetch_array($result)) {
    echo "<record>\n";
    echo "<price>".$row['price']."</price>\n";
    echo "<estime>".$row['estime']."</estime>\n";
    echo "</record>\n";
    }
echo "</table>\n";
?>


000webhost appends analytics code by default. It could be wreaking havoc on your XML.

You can disable it by going to: http://members.000webhost.com/analytics.php.


First: I doubt 000webhost are giving you root access?

Second: You can't submit header requests after already outputting to the screen, put the header line at the top of your script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜