View Single Post
Old 06-30-2009, 11:56 AM   #1 (permalink)
Izzmo
v7n Mentor
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,338
iTrader: 0 / 0%
Latest Blog:
Starting p90x today

Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Why database variables do not show up from AJAX response

I could not find ANYTHING on the internet regarding this, and it's starting to really annoy me.

It does not work any any browser.

What happens is this: I have an XMLHttp object setup, it requests a PHP page, the PHP works through everything and then populates an HTML table with database row values.

It returns the table without the database row values.

What the hell?

Any help would be appreciated.

Code:
// XMLHttp Ajax Object var xmlhttp; function loadXMLDoc(url) { xmlhttp = null; var returntxt = ""; if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); else if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); if (xmlhttp != null) { xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { alert(xmlhttp.responseText); returntxt = json_parse(xmlhttp.responseText); } else alert("Problem retrieving XML data"); } }; xmlhttp.open("GET", url, false); xmlhttp.send(null); return returntxt; } else alert("Your browser does not support XMLHTTP."); }
PHP Code:
       $db = new DB;
       
$results $db->getVehicleMeasures($_GET["year"], $_GET["make"], $_GET["model"], $_GET["trim"]);
       
$row mysql_fetch_row($results);
       echo 
json_encode("<p>Total Square Feet: ".(String)$row[0]."</p>
        <table style=\"width: 100%;\">
         <tr>
          <td><div style=\"background-color: #000000; line-height: 2px;\">&nbsp;</div></td>
          <td style=\"font-weight: bold;text-size: 14pt; width: 20px;\">OR</td>
          <td><div style=\"background-color: #000000; line-height: 2px;\">&nbsp;</div></td>
         </tr>
        </table>
        <p>Individual Square Feet per Section:
        <table style=\"width: 100%;\">
         <tr>
          <td>Front Bumper: "
.(String)$row[1]."</td>
          <td>Rear Bumper: "
.(String)$row[2]."</td>
         </tr>
         <tr>
          <td>Hood: "
.(String)$row[3]."</td>
          <td>Roof: "
.(String)$row[4]."</td>
         </tr>
         <tr>
          <td>Rear Side: "
.(String)$row[5]."</td>
          <td>Front Side: "
.(String)$row[6]."</td>
         </tr>
         <tr>
          <td>Sides: "
.(String)$row[7]."</td>
          <td>Mirrors: "
.(String)$row[10]."</td>
         </tr>
         <tr>
          <td>Back Window: "
.(String)$row[8]."</td>
          <td>Side Windows: "
.(String)$row[9]."</td>
         </tr>
        </table></p>"
);
       
$db null
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline   Reply With Quote