Jump to content

Html Tags Returned As Well


MDobleZ
 Share

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>

Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.