A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: XML delima (again)

Threaded View

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    New Mexico
    Posts
    101

    XML delima (again)

    I have xml data produced by a php page and I am trying to get information TO the php page for it to go to the database and retrieve the data and put it in xml format for flash. the problem I am having is getting the user data TO the php page...here is what I am trying to get to work:

    Code:
    serverdate = new Array();
    servercurrentQuestion = new Array();
    serveryouranswer = new Array();
    var my_xml1 = new XML();
    my_xml1.ignoreWhite = true;
    my_xml1.onLoad = function(success) {
    	if (success) {
    		
    	var myitems = my_xml1.firstChild.childNodes;
    	for (var i = 0; i<myitems.length; i++) {
    			serverdate[i] = (myitems[i].firstChild.firstChild);	//date
    			servercurrentQuestion[i] = (myitems[i].firstChild.nextSibling.firstChild);
    			serveryouranswer[i] = (myitems[i].firstChild.nextSibling.nextSibling.firstChild);
    			M1testDate = serverdate[i];
    			M1lastQuestion = servercurrentQuestion[i];
    		}
    			
    	}
    };
    username = "someusername";
    email = "someemail";
    testformat = "MATH";
    testnumber = "1";
    my_xml1.load("http://www.mydomain.com/flashdatatest.php?name="+username+"&email="+email+"&testtype="+testformat+"&testnumber="+testnumber);

    Here is my php code:
    Code:
    mysql_select_db($database_MyConnect, $MyConnect);
    $name = $_GET['username'];
    $email = $_GET['email'];
    $testtype = $_GET['testformat'];
    $testnumber = $_GET['testnumber'];
    $sql = "SELECT YourChoice, currentQuestion, DateTaken FROM anstrackuser WHERE Username = '$name' AND Email = '$email' AND TestType = '$testtype' AND TestName = 'GMAT' AND TestNumber = '$testnumber' ORDER BY anstrackuser.currentquestion ASC ";
    $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
    
    $xml_output = "<?xml version=\"1.0\"?>\n"; 
    $xml_output .= "<entries>\n"; 
    
    for($x = 0 ; $x < mysql_num_rows($result) ; $x++){ 
        $row = mysql_fetch_assoc($result); 
        $xml_output .= "\t<entry>\n"; 
        $xml_output .= "\t\t<date>" . $row['DateTaken'] . "</date>\n"; 
        $xml_output .= "\t\t<currentQuestion>" . $row['currentQuestion'] . "</currentQuestion>\n"; 
    	$xml_output .= "\t\t<yourans>" . $row['YourChoice'] . "</yourans>\n"; 
        $xml_output .= "\t</entry>\n"; 
    } 
    
    $xml_output .= "</entries>"; 
    echo $xml_output;
    I can get it to work if I put name,email,testtype,and testnumber variables in the php code but when I take them out, it stops working...this tells me I am not getting the vars from flash to php

    thanks in advance
    Last edited by Beyond Flash; 08-19-2010 at 10:10 PM.
    Beyond Flash
    Your one stop web shop
    http://www.beyondflash.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center