Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-30-2009, 11:56 AM   #1 (permalink)
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  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX: bots hitting AJAX scripts kkiely Coding Forum 1 04-21-2007 02:14 AM
Friday Night Lights (tv show), and House (tv show) sim Forum Lobby 0 10-31-2006 05:13 PM
If Statements inside Variables Izzmo Coding Forum 19 05-12-2006 02:08 AM
Variables being lost in CGI scripts GeXus Coding Forum 0 12-01-2004 02:47 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 05:19 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.