Hi,

I am bit new to flash/php progrmaing. Perhaps there is some basic mistake that I am making, your help in this regard will be appreciated.

I am trying to access a mySQLdatabase from flash using php scripts. I can do it with normal php scripts and correct output is seen in browser, but values are not returned to flash correctly. To show a basic example, here I am pasting the relevant code.

php code:
<?php
$str = "Today is " .showDate();
function showDate(){
$date = getdate();
return ($date["year"].'-'.$date["mon"].'-'.$date["mday"]);
}

$rString .= "&Time=".$str."&";
echo $rString;
?>

this script shows perfect output in a browser.
In flash I have done it like this

function ShowResults() {
//SearchResults is a text box in flash doc

SearchResults.htmlText = this["Time"];
}

// Create new loadVars object Inst for data transfer
var Inst = new LoadVars();
Inst.onLoad = ShowResults;

// trigger the script from a button's (SearchButton) onRelease event
this["SearchButton"].onRelease = function() {
Inst.sendAndLoad("DBCheck2.php",Inst,"POST");
// DBCheck2.php is in the same directory as is the
// flash doc.

}

stop();

But the ShowResults() funtion doesnot show the string that script should return, rather it displays the following value.

.$str.

The problem is that it doesn't return the value of var $str, but returns whatever is after = sign in the script. i.e '.$str.'
If I put a general string like
$rString .= "&Time="testing"&";

then it shows the value 'testing' in flash document. If some var is used, it doesn't takes its value.

Any help please?

Regards
Geegs

    Write a Reply...