• Flash vars from php
    2 replies, posted
[php] /* This sends the players money to the flash app */ require("settings.php"); if(!empty($_SESSION['loggedin']) && !empty($_SESSION['username']) && !empty($_SESSION['refraction'])) { $steam_sess = $_SESSION['steamid']; $checkusermoney = "SELECT * FROM users WHERE steamid = '".$steam_sess."'"; $result = mysql_query($checkusermoney) or die ("Error in query: $checkusermoney. ".mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { $money = $row["money"]; } } print "&money_2=" . urlencode("".$money.""); //echo "&money_2=$money"; } else { print "&money_2=" . urlencode("0"); //echo "&money_2=0"; } [/php] The flash app is displaying the money (8182) and when I run the php on it's own it shows [code]&money_2=8182[/code] However I don't think flash knows this var is an integer, How could I print an integer for flash to read?
Just read it as a string and use Number(str)
or parseInt (if int, or if float, parseFloat) var strReadFromPHP:String = "1234"; trace(strReadFromPHP + 1); var intReadFromPHP:Number = parseInt(strReadFromPHP); trace(intReadFromPHP + 1); /* output: 12341 (wrong because it's a string) 1235 (which is right) */
Sorry, you need to Log In to post a reply to this thread.