Not able to access Wordpress data base

Hi All:
I was able to access Wordpress yesterday with the following code:

<html>
<head>
<script type="text/javascript">
function loadImage()
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getuser_2.php",true);
xmlhttp.send();
alert("Image is loaded");
}
</script>
</head>
<body>
<div style="position: absolute; top:170px; left:340px; height:200px; width:200px;">

<img src="images/dk_green_box.jpg" onload="loadImage()" width="240" height="240" alt="" /> 
</div>

</body>
</html>

[php]

<?php echo "
"; echo "

Enter PHP for Data retrieval

"; echo "
"; // $q=$_GET["q"]; // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'XXXXXX'); /** MySQL database username */ define('DB_USER', 'XXXXXX'); /** MySQL database password */ define('DB_PASSWORD', 'XXXXXX'); /** MySQL hostname */ define('DB_HOST', 'XXXXXX'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$con) { die('Could not connect: ' . mysql_error()); } else { echo('in the database'); } mysql_select_db( DB_NAME, $con); $sql = "SELECT * FROM wp_posts where post_title != 'Auto Draft' order by ID desc limit 0,1"; $result = mysql_query($sql); if (!$result) { die('No data: ' . mysql_error()); echo "
"; echo "

Data failure

"; echo "
"; } else { echo "
"; echo "

Data Success

"; echo "
"; echo "
"; echo ('BLOG'); echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; } echo "
Title Content
" . $row['post_title'] . "" . substr($row['post_content'],0,100) . "
"; mysql_close($con); } ?>[/php]

Today I started adding in code to see why it was not working on a different page and it is now not working at all. Does anyone see anything I am missing? There are no errors or warnings. The echos are not working to let me know it is in the data base. The alert in the JAVA code works so I know I am getting that far.
The strangest part is it was working yesterday and earlier today before I started adding in parts from a different page.

Sponsor our Newsletter | Privacy Policy | Terms of Service