Jump to content

Html Tags Returned As Well


MDobleZ

Recommended Posts

html tags appear when I retrieve info from a table. This is my .js:

 

function receive()

{

var xmlhttp=false;

xmlhttp=new XMLHttpRequest();

 

xmlhttp.open("GET","step2.php",false);

xmlhttp.onreadystatechange=function()

{

if (xmlhttp.readyState==4 && xmlhttp.status==200)

{

 

document.getElementById("answer").innerText=xmlhttp.responseText;

}

}

 

xmlhttp.send();

 

}

 

And this is my .php:

 

 

<html>

<body>

<?php

$con2=mysql_connect("sql108.getfreehosting.co.uk","getfh_6562567","19770514");

mysql_select_db("getfh_6562567_fch",$con2);

$result=mysql_query("SELECT message FROM chat WHERE Id=1");

$row=mysql_fetch_array($result);

echo $row[0];

mysql_close($con2);

?>

</body>

</html>

 

What am I doing wrong?

 

Thanks.

Link to comment
Share on other sites

What am I doing wrong?

Besides posting your database credentials in a public place? You're not looking at your PHP code, that's what you're doing wrong.

 

Look at it.

<html>
<body>
<?php
$con2=mysql_connect("...", "...", "...");
mysql_select_db("...",$con2);
$result=mysql_query("SELECT message FROM chat WHERE Id=1");
$row=mysql_fetch_array($result);
echo $row[0];
mysql_close($con2);
?>
</body>
</html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.