I have some php code in a seperate file and its being called using javascript. But the php code isnt working. instead its just putting the code in the div. Like the full code is in the div. how can i make this php code execute
My javascript function looks like this:
function checklogin(){
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if(xmlhttp.responseText='FAILED')
{alert('failed');};
}
}
var Usrname
Usrname=document.getElementById("edtLoginUsername").text;
xmlhttp.open("GET","DatabaseFunctions.php?Username="+Usrname,true);
xmlhttp.send();};
AND MY PHP Code look like this:
<?php
$myServer = "example.com";
$myUser = "dbuser";
$myPass = "dbpass";
$myDB = "efarm";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT COUNT(*) FROM Users WHERE Username=myQuoteString('$_GET(USERNAME)')'";
//execute the SQL query and return records
$result = mssql_query($query);
echo 'FAILED';
//close the connection
mssql_close($dbhandle);
?>
i have already checked my httpd.conf file and checked that the php is installed and configured